Skip to content

Commit 573f498

Browse files
committed
Initial commit
0 parents  commit 573f498

File tree

9 files changed

+466
-0
lines changed

9 files changed

+466
-0
lines changed
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# This workflow will upload a Python Package using Twine when a release is created
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
3+
4+
# This workflow uses actions that are not certified by GitHub.
5+
# They are provided by a third-party and are governed by
6+
# separate terms of service, privacy policy, and support
7+
# documentation.
8+
9+
name: Upload Python Package
10+
11+
on:
12+
release:
13+
types: [published]
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
deploy:
20+
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- uses: actions/checkout@v3
25+
- name: Set up Python
26+
uses: actions/setup-python@v3
27+
with:
28+
python-version: '3.x'
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install build
33+
pip install wheel
34+
- name: Build package
35+
run: python3 setup.py sdist bdist_wheel
36+
- name: Publish package
37+
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
38+
with:
39+
user: __token__
40+
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# RatpAPI Python Wrapper
2+
3+
## Overview
4+
RatpAPI is a Python wrapper for interacting with the RATP (Régie Autonome des Transports Parisiens) API. This library provides easy access to real-time traffic information, line-specific traffic details, and affluence data for journeys on the RATP network in Paris.
5+
6+
## Features
7+
- Fetch global traffic information on the RATP network.
8+
- Retrieve traffic information for specific lines.
9+
- Get affluence data for journeys on particular lines.
10+
11+
## Installation
12+
To use RatpAPI in your project, you can clone this repository:
13+
```bash
14+
git clone [repository URL]
15+
```
16+
17+
## Usage
18+
19+
### Setting Up
20+
First, import the `RatpAPI` class and initialize it with your API key:
21+
22+
```python
23+
from ratp_api.main import RatpAPI
24+
25+
api = RatpAPI(api_key="your_api_key_here")
26+
```
27+
28+
### Fetching Global Traffic Information
29+
To get global traffic data:
30+
```python
31+
global_traffic = api.get_global_traffic()
32+
print(global_traffic)
33+
```
34+
35+
### Fetching Line-Specific Traffic
36+
To get traffic information for a specific line:
37+
```python
38+
line_traffic = api.get_line_traffic("line_id_here")
39+
print(line_traffic)
40+
```
41+
42+
### Fetching Affluence for Journeys
43+
To get affluence data for a specific journey on a line:
44+
```python
45+
start_coords = (longitude, latitude) # Start location coordinates
46+
end_coords = (longitude, latitude) # End location coordinates
47+
line_id = "line_id_here"
48+
49+
affluence_data = api.get_affluence(start=start_coords, end=end_coords, line_id=line_id)
50+
print(affluence_data)
51+
```
52+
53+
### Fetching Affluence for All Lines
54+
To get affluence data for all lines:
55+
```python
56+
all_lines_affluence = api.get_all_lines_affluence()
57+
print(all_lines_affluence)
58+
```
59+
60+
## Contributing
61+
Contributions to the RatpAPI project are welcome! Please refer to the contributing guidelines for more information.
62+
63+
## License
64+
This project is licensed under [appropriate license] - see the LICENSE file for details.
65+
66+
---
67+
68+
Replace `[repository URL]` with the actual URL of your GitHub repository and `[appropriate license]` with the license type you've chosen for your project. This README provides a basic introduction to your project, including how to install and use the library. Feel free to modify and expand it according to the needs of your project.

affluence/line_mappings.py

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
line_end_points = {
2+
"1": {
3+
"start": {
4+
"name": "La Défense",
5+
"coords": (2.237018056395013, 48.89218707551516),
6+
},
7+
"end": {
8+
"name": "Château de Vincennes",
9+
"coords": (2.440439978057246, 48.844456393634566),
10+
},
11+
},
12+
"2": {
13+
"start": {
14+
"name": "Porte Dauphine",
15+
"coords": (2.277083018415724, 48.87146657720145),
16+
},
17+
"end": {"name": "Nation", "coords": (2.395554512170687, 48.84757936654253)},
18+
},
19+
"3": {
20+
"start": {
21+
"name": "Pont de Levallois",
22+
"coords": (2.280413812210845, 48.89715409503059),
23+
},
24+
"end": {"name": "Gallieni", "coords": (2.41669727284764, 48.86533531722583)},
25+
},
26+
"3bis": {
27+
"start": {"name": "Gambetta", "coords": (2.398746593442591, 48.86516343394703)},
28+
"end": {
29+
"name": "Porte des Lilas",
30+
"coords": (2.40672924554309, 48.87711051082896),
31+
},
32+
},
33+
"4": {
34+
"start": {
35+
"name": "Porte de Clignancourt",
36+
"coords": (2.344847748752398, 48.89740222196378),
37+
},
38+
"end": {
39+
"name": "Mairie de Montrouge",
40+
"coords": (2.319740313298555, 48.818676408977936),
41+
},
42+
},
43+
"5": {
44+
"start": {"name": "Bobigny", "coords": (2.449189904479335, 48.906374770235026)},
45+
"end": {
46+
"name": "Place d'Italie",
47+
"coords": (2.35558027407791, 48.830972672053754),
48+
},
49+
},
50+
"6": {
51+
"start": {
52+
"name": "Kléber",
53+
"coords": (2.293240649947313, 48.87126214352652),
54+
},
55+
"end": {"name": "Picpus", "coords": (2.401289019827348, 48.84506157901035)},
56+
},
57+
"7": {
58+
"start": {
59+
"name": "La Courneuve",
60+
"coords": (2.410598616469425, 48.920785968128676),
61+
},
62+
"end": {"name": "Villejuif", "coords": (2.368269540049694, 48.79648308361576)},
63+
},
64+
"7bis": {
65+
"start": {
66+
"name": "Louis Blanc",
67+
"coords": (2.364378741179748, 48.8811921181366),
68+
},
69+
"end": {
70+
"name": "Pré Saint-Gervais",
71+
"coords": (2.398468172268172, 48.88027195609515),
72+
},
73+
},
74+
"8": {
75+
"start": {"name": "Balard", "coords": (2.278330259866023, 48.836295300607894)},
76+
"end": {
77+
"name": "Pointe du Lac",
78+
"coords": (2.464280070543357, 48.76881073327119),
79+
},
80+
},
81+
"9": {
82+
"start": {
83+
"name": "Pont de Sèvres",
84+
"coords": (2.231028100202621, 48.829746119059685),
85+
},
86+
"end": {
87+
"name": "Mairie de Montreuil",
88+
"coords": (2.441521809411031, 48.86229941188523),
89+
},
90+
},
91+
"10": {
92+
"start": {"name": "Boulogne", "coords": (2.228536981491631, 48.8407450151916)},
93+
"end": {
94+
"name": "Gare d'Austerlitz",
95+
"coords": (2.375747983215603, 48.82999019896456),
96+
},
97+
},
98+
"11": {
99+
"start": {"name": "Châtelet", "coords": (2.348036565400401, 48.85763140976555)},
100+
"end": {
101+
"name": "Mairie des Lilas",
102+
"coords": (2.416479643681515, 48.87976125216355),
103+
},
104+
},
105+
"12": {
106+
"start": {
107+
"name": "Front Populaire",
108+
"coords": (2.365920319400959, 48.90656714504601),
109+
},
110+
"end": {
111+
"name": "Mairie d'Issy",
112+
"coords": (2.273665557499754, 48.82430937015939),
113+
},
114+
},
115+
"13": {
116+
"start": {
117+
"name": "Saint-Denis",
118+
"coords": (2.359366296360598, 48.93677678897849),
119+
},
120+
"end": {"name": "Châtillon", "coords": (2.301678555482428, 48.81074648584623)},
121+
},
122+
"14": {
123+
"start": {
124+
"name": "Mairie de Saint-Ouen",
125+
"coords": (2.334663150119757, 48.9132020942236),
126+
},
127+
"end": {"name": "Olympiades", "coords": (2.367173024477846, 48.8271636169609)},
128+
},
129+
}

pyproject.toml.toml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
[build-system]
2+
requires = ["poetry-core>=1.0.0"]
3+
build-backend = "poetry.core.masonry.api"
4+
5+
[tool.poetry]
6+
name = "ratp_api"
7+
version = "0.1.0"
8+
description = "Get lyrics of any songs, for free."
9+
authors = ["Romeo Phillips"]
10+
11+
[tool.poetry.dependencies]
12+
python = "^3.7"
13+
certifi = "2023.7.22"
14+
requests = "2.31.0"
15+
wheel = "0.41.2"
16+
17+
18+
[build]
19+
script = "build.py"

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
requests==2.31.0

setup.cfg

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[metadata]
2+
version = attr: ratp_api.__version__
3+
license_files = LICENSE

setup.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import setuptools
2+
3+
with open("README.md", "r", encoding="utf-8") as fh:
4+
long_description = fh.read()
5+
6+
setuptools.setup(
7+
name="ratp_api",
8+
author="Roméo Phillips",
9+
author_email="phillipsromeo@gmail.com",
10+
description="Extract lyrics from MusicXMatch API, for free.",
11+
keywords="ratp, rer, metro, api, ratp_api, ratp_api-python",
12+
long_description=long_description,
13+
long_description_content_type="text/markdown",
14+
url="https://github.com/tomchen/example_pypi_package",
15+
project_urls={
16+
"Documentation": "https://github.com/Strvm/ratp-api-python",
17+
"Bug Reports": "https://github.com/Strvm/ratp-api-python",
18+
"Source Code": "https://github.com/Strvm/ratp-api-python",
19+
},
20+
package_dir={"": "src"},
21+
packages=setuptools.find_packages(where="src"),
22+
classifiers=[
23+
"Development Status :: 5 - Production/Stable",
24+
"Intended Audience :: Developers",
25+
"Topic :: Software Development :: Build Tools",
26+
"Programming Language :: Python :: 3",
27+
"Programming Language :: Python :: 3.6",
28+
"Programming Language :: Python :: 3.7",
29+
"Programming Language :: Python :: 3.8",
30+
"Programming Language :: Python :: 3.9",
31+
"Programming Language :: Python :: 3 :: Only",
32+
"License :: OSI Approved :: MIT License",
33+
"Operating System :: OS Independent",
34+
],
35+
python_requires=">=3.6",
36+
extras_require={
37+
"dev": ["check-manifest"],
38+
},
39+
install_requires=["requests"],
40+
)

src/ratp_api/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__version__ = "1.0.0"
2+
3+
from .main import *

0 commit comments

Comments
 (0)