Skip to main content

Python client for OSRM API

Project description

A Python client for OSRM API

Running the test suite

python setup.py test

Requires

  • requests

  • aiohttp

Usage

With using requests

import osrm

client = 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

import asyncio
import osrm

loop = asyncio.get_event_loop()

async def request():
    client = osrm.AioHTTPClient(host='http://localhost:5000')
    response = await client.route(
        coordinates=[[-74.0056, 40.6197], [-74.0034, 40.6333]],
        overview=osrm.overview.full)
    print(response)
    await client.close()

loop.run_until_complete(request())

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

osrm-py-0.5.tar.gz (6.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page