Skip to main content

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

python_navitia_client-1.1.3.tar.gz (34.5 kB view details)

Uploaded Source

Built Distribution

python_navitia_client-1.1.3-py3-none-any.whl (73.4 kB view details)

Uploaded Python 3

File details

Details for the file python_navitia_client-1.1.3.tar.gz.

File metadata

  • Download URL: python_navitia_client-1.1.3.tar.gz
  • Upload date:
  • Size: 34.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.0.0 CPython/3.12.4

File hashes

Hashes for python_navitia_client-1.1.3.tar.gz
Algorithm Hash digest
SHA256 2f9e1bc030b026937ce8dae03922dfdd164d5332ea90250b46d3717fc4235a01
MD5 5194f562e085733ab8f12e9e44ed35b4
BLAKE2b-256 185ffafe2e5fec2cc79e73c5277ebb70f7425b6a0ce5eec66653dfc6901378f0

See more details on using hashes here.

File details

Details for the file python_navitia_client-1.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for python_navitia_client-1.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c9e0508487768e201ebff13c04afeb949ffe0fff6dd0a18a65cd80cf57a31d29
MD5 c8f39708d1cac8a27585acec5997bb20
BLAKE2b-256 b3c4f81acd82970dd42696cce87fe5f099392d179de7e66c45893bb290fea7ac

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page