https://github.com/bdamokos/mobility-db-api
Python package to download GTFS files through the Mobility Database API
https://github.com/bdamokos/mobility-db-api
api gtfs gtfs-schedule mobility-data public-transit public-transport public-transportation
Last synced: 4 months ago
JSON representation
Python package to download GTFS files through the Mobility Database API
- Host: GitHub
- URL: https://github.com/bdamokos/mobility-db-api
- Owner: bdamokos
- License: mit
- Created: 2024-12-22T18:15:20.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-03T10:18:05.000Z (over 1 year ago)
- Last Synced: 2025-10-30T02:22:56.218Z (7 months ago)
- Topics: api, gtfs, gtfs-schedule, mobility-data, public-transit, public-transport, public-transportation
- Language: Python
- Homepage: https://bdamokos.github.io/mobility-db-api/
- Size: 831 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: docs/contributing.md
- License: LICENSE
Awesome Lists containing this project
README
# Mobility Database API Client
[](https://badge.fury.io/py/mobility-db-api)
[](https://github.com/bdamokos/mobility-db-api/actions/workflows/tests.yml)
[](https://codecov.io/gh/bdamokos/mobility-db-api)
[](https://opensource.org/licenses/MIT)
[](https://bdamokos.github.io/mobility-db-api/)
A Python client for downloading GTFS files through the [Mobility Database](https://database.mobilitydata.org/) 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
## Installation
```bash
pip install mobility-db-api
```
## Quick Example
```python
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](https://bdamokos.github.io/mobility-db-api/), including:
- [Quick Start Guide](https://bdamokos.github.io/mobility-db-api/quickstart/)
- [Examples](https://bdamokos.github.io/mobility-db-api/examples/)
- [API Reference](https://bdamokos.github.io/mobility-db-api/api-reference/client/)
- [Contributing Guide](https://bdamokos.github.io/mobility-db-api/contributing/)
## Development
```bash
# 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](LICENSE) file for details.
## Acknowledgments
- [Mobility Database](https://database.mobilitydata.org/) for providing the API