Python client for OSRM api
Project description
py-osrm-client
Simple and typed Python client for OSRM api.
Requirements
Installation
pip install py-osrm-client
Usage
Async client:
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:
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. To use another OSRM server:
async with OsrmAsyncClient(base_url='https://my-custom-osrm-server.com') as osrm:
# use client
Refer to OSRM api documentation for more details about OSRM services and options.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
py-osrm-client-1.1.0.tar.gz
(10.7 kB
view hashes)
Built Distribution
Close
Hashes for py_osrm_client-1.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f85d207c984b0c8fd2750773bcef074fb22b2a5ed882d8074398331cfb217390 |
|
MD5 | 37285419cbcf83432a2bf43c362b2896 |
|
BLAKE2b-256 | 022203669b0efcb7e9be83bf67973f79a11d0cd04c2f5dd78fe8fb598ca22d4d |