SDKs
Python SDK
The official Wayline SDK for Python: Python 3.9+. Sync and async clients built on httpx. Fully type-hinted.
Install
pip install wayline
# or: uv add wayline · poetry add waylineQuickstart
Set WAYLINE_API_KEY to a test key (see the Quickstart), then:
from wayline import Wayline, AsyncWayline
client = Wayline() # reads WAYLINE_API_KEY from the environment
d = client.distance(origin=(23.7925, 90.4078), destination="23.733,90.4172", units="imperial")
print(d.distance_miles, d.duration_seconds)
batch = client.distance_batch(points=[(23.7925, 90.4078), (23.7937, 90.4066), (23.7465, 90.376)], units="imperial")
print(batch.total_distance_miles)
# Async
async def main():
async with AsyncWayline() as aclient:
m = await aclient.matrix(origins=[(23.7925, 90.4078)], destinations=[(23.733, 90.4172)])
print(m.rows[0].elements[0].duration_seconds)Errors
Non-2xx responses raise a typed error after retries are exhausted. Branch on code — the full list is in the error reference.
from wayline import WaylineError
try:
client.distance(origin="0,0", destination="0,1")
except WaylineError as e:
print(e.code, e.status, e.request_id)Configuration
| Option | Default | Description |
|---|---|---|
| API key | WAYLINE_API_KEY | Your live or test key. Never logged. |
| Base URL | https://api.wayline.cloud | Override for staging or a proxy. |
| Timeout | 30 seconds | Per attempt. |
| Max retries | 3 | For 429 and 5xx, with exponential backoff + jitter, honoring Retry-After. |
Source and releases
Package: wayline on PyPI. Source: packages/sdk-python. Versions follow semantic versioning; see the CHANGELOG in the package and our product changelog.