A Python client for OSRM API
pythonsetup.pytest- requests
- aiohttp
With using requests
importosrmclient=osrm.Client(host='http://localhost:5000')
response=client.route(
coordinates=[[-74.0056, 40.6197], [-74.0034, 40.6333]],
overview=osrm.overview.full)
print(response)With using aiohttp
importasyncioimportosrmloop=asyncio.get_event_loop()
asyncdefrequest():
client=osrm.AioHTTPClient(host='http://localhost:5000')
response=awaitclient.route(
coordinates=[[-74.0056, 40.6197], [-74.0034, 40.6333]],
overview=osrm.overview.full)
print(response)
awaitclient.close()
loop.run_until_complete(request())