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.
- Fetch global traffic information on the RATP network.
- Retrieve traffic information for specific lines using the
LineIDenum for easy reference. - Get affluence data for journeys on particular lines.
To use RatpAPI in your project, you can install it via pip:
pip install ratp-api-pythonFirst, import the RatpAPI class and initialize it with your API key:
from ratp_api.main import RatpAPI
api = RatpAPI()The LineID enum provides a convenient way to reference specific lines by their IDs:
from ratp_api.enums import LineID
# Example: Using LineID for RER A
line_id = LineID.RER_ATo get global traffic data:
global_traffic = api.get_global_traffic()
print(global_traffic)To get traffic information for a specific line using the LineID enum:
line_traffic = api.get_line_traffic(LineID.RER_A)
print(line_traffic)To get affluence data for a specific journey on a line:
start_coords = (longitude, latitude) # Start location coordinates
end_coords = (longitude, latitude) # End location coordinates
line_id = LineID.RER_A # Using LineID enum
affluence_data = api.get_affluence(start=start_coords, end=end_coords, line_id=line_id)
print(affluence_data)To get affluence data for all lines:
all_lines_affluence = api.get_all_lines_affluence()
print(all_lines_affluence)Contributions to the RatpAPI project are welcomed!
This project is licensed under the MIT License.