Mobility Database API Client¶
A Python client for downloading GTFS files through the Mobility Database API.
Features¶
- Search for GTFS providers by country or name
- 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
Installation¶
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¶
- Quick Start Guide - Get up and running in minutes
- Examples - Common use cases and patterns
- API Reference - Detailed API documentation
- Contributing - Help improve the client
- Changelog - Latest changes and updates