Docs · Python

Frameworks

Python

Routing with requests — distance and driving time.

Example

route.pypy
1import os2import requests34ORVIA = "https://orviamaps.ir/api/v1"5HEADERS = {"Authorization": f"Bearer {os.environ['ORVIA_API_KEY']}"}67# Fastest driving route, Tehran → Isfahan8resp = requests.get(9    f"{ORVIA}/route",10    params={"from": "35.6892,51.3890", "to": "32.6546,51.6680"},11    headers=HEADERS,12    timeout=10,13)14route = resp.json()["route"]15print(route["distanceM"] / 1000, "km", route["durationS"] / 3600, "h")

Replace YOUR_API_KEY with a key from your account, or read it from an environment variable as shown.