https://github.com/tomrss/py-osrm-client
Python client for OSRM api
https://github.com/tomrss/py-osrm-client
client osrm osrm-api
Last synced: 18 days ago
JSON representation
Python client for OSRM api
- Host: GitHub
- URL: https://github.com/tomrss/py-osrm-client
- Owner: tomrss
- License: mit
- Created: 2023-12-21T15:00:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-11-30T12:38:04.000Z (4 months ago)
- Last Synced: 2026-03-02T02:19:16.849Z (22 days ago)
- Topics: client, osrm, osrm-api
- Language: Python
- Homepage:
- Size: 33.2 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# py-osrm-client


[](https://badge.fury.io/py/py-osrm-client)
Simple and typed Python client for [OSRM](https://project-osrm.org/) api.
## Requirements
- [requests](https://pypi.org/project/requests/)
- [aiohttp](https://pypi.org/project/aiohttp/)
## Installation
```shell
pip install py-osrm-client
```
## Usage
Async client:
```python
import asyncio
from osrm import OsrmAsyncClient
async def example():
async with OsrmAsyncClient() as osrm:
coordinates = [(0.1, 0.2), (0.3, 0.4)]
trip = await osrm.trip(coordinates)
print(trip)
asyncio.run(example())
```
Sync client:
```python
from osrm import OsrmClient
with OsrmClient() as osrm:
coordinates = [(0.1, 0.2), (0.3, 0.4)]
trip = osrm.trip(coordinates)
print(trip)
```
By default the clients will refer to the OSRM demo server at [https://router.project-osrm.org](https://router.project-osrm.org).
To use another OSRM server:
```python
async with OsrmAsyncClient(base_url='https://my-custom-osrm-server.com') as osrm:
# use client
```
Refer to [OSRM api documentation](https://project-osrm.org/docs/v5.24.0/api/) for more details
about OSRM services and options.