Skip to main content

Mobility Database API Client

PyPI version Tests codecov License: MIT Documentation

A Python client for downloading GTFS files through the Mobility Database API.

Features

  • Search for GTFS providers by country, name or id
  • Download GTFS datasets from hosted or direct sources
  • Track dataset metadata and changes
  • Thread-safe and process-safe operations
  • Automatic token refresh and error handling

Without an API token, the client uses MobilityData's current V2 CSV catalog. CSV searches support full feed IDs such as mdb-123, tld-5862, and tdg-81995; numeric IDs such as 123 also resolve to their mdb- feed. Inactive, deprecated, redirected, and non-GTFS feeds are excluded. The V2 catalog has a separate cache, so first use after upgrading requires an internet connection.

Installation

pip install mobility-db-api

Quick Example

from mobility_db_api import MobilityAPI

# Initialize client (uses MOBILITY_API_REFRESH_TOKEN env var)
api = MobilityAPI()

# Search for providers in Belgium
providers = api.get_providers_by_country("BE")
print(f"Found {len(providers)} providers")

# Download a dataset
if providers:
    dataset_path = api.download_latest_dataset(providers[0]['id'])
    print(f"Dataset downloaded to: {dataset_path}")

Documentation

Full documentation is available at bdamokos.github.io/mobility-db-api, including:

Development

# Clone repository
git clone https://github.com/bdamokos/mobility-db-api.git
cd mobility-db-api

# Install in development mode
pip install -e ".[dev]"

# Run tests
pytest

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

Metadata

Release files for mobility-db-api 0.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mobility-db-api 0.6.1
File Size Uploaded Provenance Actions
mobility_db_api-0.6.1.tar.gz 20.6 kB Without provenance Details for mobility_db_api-0.6.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mobility-db-api 0.6.1
File Interpreter ABI Platform Actions
mobility_db_api-0.6.1-py3-none-any.whl Python 3 none any Details for mobility_db_api-0.6.1-py3-none-any.whl

Total release size: 41.9 kB

Release files / mobility_db_api-0.6.1.tar.gz

Download URL mobility_db_api-0.6.1.tar.gz
Size 20.6 kB
Tags Source
SHA-256 checksum
How to use checksums
20f59556dae3f219b74c2c6d3b172235f6b3ea12b647f5bf8e3c63a1abee88bb
BLAKE2b-256 checksum
How to use checksums
a2be8654d4d837338ba7e2bce2980a48f428b0bd6b73c4e7aa97b6de016f2e67
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / mobility_db_api-0.6.1-py3-none-any.whl

Download URL mobility_db_api-0.6.1-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1490d3b44e77290341057f27dd9dba1006aabfaf67b2ba171d7e51c644ad7de1
BLAKE2b-256 checksum
How to use checksums
5f6ecd50120b39c099da77359479c3e4c55590f105fc0210274b1fc18f6c5473
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for mobility-db-api 0.6.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page