Python library to use with Navitia APIs
Project description
navitia-client
This repository provides a unofficial Python wrapper to use navitia.io APIs.
Pre-requisites
To use this library, you will need an access token from navitia.io.
Installation
The package is available on PiPy
pip install python-navitia-client
API support
The library supports the following APIs:
API | Supported ? | Comment |
---|---|---|
Coverage | ✅ | |
Datasets | ✅ | |
Contributors | ✅ | |
Inverted geocoding | ✅ | |
Public transportation Objects exploration | ✅ | |
Autocomplete on Public Transport objects | ✅ | |
Autocomplete on geographical objects | ✅ | |
Places nearby | ✅ | |
Journeys | ✅ | |
Isochrones | ✅ | Beta endpoint according to API response |
Route Schedules | ✅ | |
Stop Schedules | ✅ | |
Terminus Schedules | ✅ | |
Departures | ✅ | |
Arrivals | ✅ | |
Line reports | ✅ | Beta endpoint according to API response |
Traffic reports | ✅ | Beta endpoint according to API response |
Equipment reports | ❌ | Beta service, not available to all providers |
Usage
To use this library, you need an authentication token provided by Navitia.io.
Create client instance
Once created, you will create an instance of the NavitiaClient class with the following:
from navitia_client.client import NavitiaClient
client = NavitiaClient(auth=<YOUR_TOKEN_HERE>)
A base URL for Navitia IO is hardcoded and provided to NavitiaClient by default. It can be updated using the base_navitia_url parameter.
Access APIs data
URLs are mapped as property in the class NavitiaClient
. You can find the mapping here.
For example, if you want to have the list of datasets in a given region, use:
datasets, pagination = client.datasets.list_datasets(region_id=<REGION_ID>)
Pagination
A couple of APIs are paginated, in particular the public transporations APIs.. In such case, you can navigate in the response using the parameters start_page
and count
.
An object Pagination
will be provided by the impacted methods to help you navigating.
Tips
Few tips on how to use the Navitia APIs are available here.
Dependencies
- Python >= 3.10
- requests>=2.31
Additional dependencies are described in the pyproject.toml file.
Contributing
You are free to contribute to the repo. Please read Contributing.md.
Additional questions
-
Are you affiliated with Navitia ? No. This is an unofficial wrapper for the Navitia.io APIs.
-
Is this client asynchronous ? No, and it is not planned to. If you want to add async support, feel free to contribute.
-
Is this client production ready ? Yes and no. For my own purpose, it is, but I cannot guarantee that everything will behave well. If you spot a bug, please open an issue in the repo.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_navitia_client-1.1.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 057d92dfd9ba68e2badf2c0475e00940ba63d1261db11b1bc0ef596b23e03ded |
|
MD5 | 7e2d59b86f2ea1205dc3c11029425277 |
|
BLAKE2b-256 | 88011faaedd5c7c54ceac8bf111616a589647c8b9f047dc1921b146edf9bb9e2 |
Hashes for python_navitia_client-1.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b41585c49f1af609720ac4365d5286b807c7b96f319b0ec5f7f5217ac0a8285b |
|
MD5 | 47c3f55a4efbbeda3ed40854afb36305 |
|
BLAKE2b-256 | dc4cf13165cdea5b555d46cd0c37a0015896f6a2f0eee9ba6456af1f93579991 |