Mobility Database API Client
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
- Mobility Database for providing the API
Metadata
Release files for mobility-db-api 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| mobility_db_api-0.6.0.tar.gz | 20.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mobility_db_api-0.6.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 41.8 kB
Release files / mobility_db_api-0.6.0.tar.gz
| Download URL | mobility_db_api-0.6.0.tar.gz |
|---|---|
| Size | 20.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2e3022f2613edfbad1d5cd0b3d4966378157faa884c0f96b9da4573172c7c871
|
|
BLAKE2b-256 checksum How to use checksums |
26b5e7147452732d0c0f63344add3b1517cb2edad417732762afe7a629aafc20
|
| 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.0-py3-none-any.whl
| Download URL | mobility_db_api-0.6.0-py3-none-any.whl |
|---|---|
| Size | 21.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
85bff0724bd05a0800103d5560cc76d5840148fa0e5894d52547a1040b30e5eb
|
|
BLAKE2b-256 checksum How to use checksums |
ee0eb55ee5cd71224a182be9598a87d0dad6396d8412baed7323b857f4658edb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.8
|