# 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
Raw data
{
"_id": null,
"home_page": null,
"name": "mobility-db-api",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": null,
"keywords": "gtfs, public-transport, mobility, transit, open-data, transportation, api-client, mobility-database",
"author": "Bence Damokos",
"author_email": null,
"download_url": "https://files.pythonhosted.org/packages/ed/a7/ad03e684b74e6a274f68de95de439a797c7773e28f7d0dccfdcf35f7bfe9/mobility_db_api-0.4.2.tar.gz",
"platform": null,
"description": "# Mobility Database API Client\n\n[](https://badge.fury.io/py/mobility-db-api)\n[](https://github.com/bdamokos/mobility-db-api/actions/workflows/tests.yml)\n[](https://codecov.io/gh/bdamokos/mobility-db-api)\n[](https://opensource.org/licenses/MIT)\n[](https://bdamokos.github.io/mobility-db-api/)\n\nA Python client for downloading GTFS files through the [Mobility Database](https://database.mobilitydata.org/) API.\n\n## Features\n\n- Search for GTFS providers by country, name or id\n- Download GTFS datasets from hosted or direct sources\n- Track dataset metadata and changes\n- Thread-safe and process-safe operations\n- Automatic token refresh and error handling\n\n## Installation\n\n```bash\npip install mobility-db-api\n```\n\n## Quick Example\n\n```python\nfrom mobility_db_api import MobilityAPI\n\n# Initialize client (uses MOBILITY_API_REFRESH_TOKEN env var)\napi = MobilityAPI()\n\n# Search for providers in Belgium\nproviders = api.get_providers_by_country(\"BE\")\nprint(f\"Found {len(providers)} providers\")\n\n# Download a dataset\nif providers:\n dataset_path = api.download_latest_dataset(providers[0]['id'])\n print(f\"Dataset downloaded to: {dataset_path}\")\n```\n\n## Documentation\n\nFull documentation is available at [bdamokos.github.io/mobility-db-api](https://bdamokos.github.io/mobility-db-api/), including:\n\n- [Quick Start Guide](https://bdamokos.github.io/mobility-db-api/quickstart/)\n- [Examples](https://bdamokos.github.io/mobility-db-api/examples/)\n- [API Reference](https://bdamokos.github.io/mobility-db-api/api-reference/client/)\n- [Contributing Guide](https://bdamokos.github.io/mobility-db-api/contributing/)\n\n## Development\n\n```bash\n# Clone repository\ngit clone https://github.com/bdamokos/mobility-db-api.git\ncd mobility-db-api\n\n# Install in development mode\npip install -e \".[dev]\"\n\n# Run tests\npytest\n```\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Acknowledgments\n\n- [Mobility Database](https://database.mobilitydata.org/) for providing the API\n\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python client for the Mobility Database API",
"version": "0.4.2",
"project_urls": {
"Bug Tracker": "https://github.com/bdamokos/mobility-db-api/issues",
"Documentation": "https://bdamokos.github.io/mobility-db-api/",
"Homepage": "https://github.com/bdamokos/mobility-db-api"
},
"split_keywords": [
"gtfs",
" public-transport",
" mobility",
" transit",
" open-data",
" transportation",
" api-client",
" mobility-database"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "616892787825a897999bb39c0dad7f0fb5da75d4d1158c888d35d35521f86b74",
"md5": "abc02c55dac1cd806a146c1ad79e18ef",
"sha256": "ed58df98ecbd0df101dcdfaeab2491cd7395002951350d8a2d77a52725a282e0"
},
"downloads": -1,
"filename": "mobility_db_api-0.4.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "abc02c55dac1cd806a146c1ad79e18ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 16051,
"upload_time": "2024-12-30T11:34:16",
"upload_time_iso_8601": "2024-12-30T11:34:16.094300Z",
"url": "https://files.pythonhosted.org/packages/61/68/92787825a897999bb39c0dad7f0fb5da75d4d1158c888d35d35521f86b74/mobility_db_api-0.4.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "eda7ad03e684b74e6a274f68de95de439a797c7773e28f7d0dccfdcf35f7bfe9",
"md5": "2b74130adc530d6c8611e4edd3972fee",
"sha256": "2835d153cfdd77a1665096cb7f32020836f08874a02b9d9417b47d6a8922f893"
},
"downloads": -1,
"filename": "mobility_db_api-0.4.2.tar.gz",
"has_sig": false,
"md5_digest": "2b74130adc530d6c8611e4edd3972fee",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 16248,
"upload_time": "2024-12-30T11:34:18",
"upload_time_iso_8601": "2024-12-30T11:34:18.093337Z",
"url": "https://files.pythonhosted.org/packages/ed/a7/ad03e684b74e6a274f68de95de439a797c7773e28f7d0dccfdcf35f7bfe9/mobility_db_api-0.4.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-12-30 11:34:18",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "bdamokos",
"github_project": "mobility-db-api",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "requests",
"specs": [
[
">=",
"2.31.0"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
">=",
"1.0.0"
]
]
},
{
"name": "unidecode",
"specs": [
[
">=",
"1.3.7"
]
]
}
],
"lcname": "mobility-db-api"
}