Skip to main content

Setup

Install addresszen from PyPI, create one AddressZen client with your API key and reuse it for every request.

pip install addresszen
client.pypython
import os

from addresszen import AddressZen

with AddressZen(os.environ["ADDRESSZEN_API_KEY"]) as client:
hits = client.find_address(query="100 Queen St W, Toronto", context="CAN").hits

The client keeps a pool of HTTP connections open. Use it as a context manager, or call close() when your process finishes.

Client options​

ArgumentDefaultPurpose
api_keyrequiredYour API key, beginning ak_
timeout10.0Seconds to wait for each request
base_urlhttps://api.addresszen.com/v1API root. Change it only to point at a test server
transportNoneAn HTTPX transport, such as httpx.MockTransport in tests

Every argument after api_key is keyword-only.

Management Key​

To read or change your account: key details, usage, logs, licensees and configs. A Management Key begins uk_. Pass it to each of those methods as user_token; the SDK sends it in the Authorization header, never in the URL.

A Management Key controls your account. Keep it in a secret store on your server, never in a browser or mobile app.

Async code​

The client is synchronous. From an async application, run calls in a worker thread with asyncio.to_thread.

User-Agent​

Every request carries User-Agent: addresszen-python-sdk/<version>, such as addresszen-python-sdk/0.1.0. The header holds no credentials or address data.