Skip to main content

az511-client

PyPI version Python versions License: MIT

Python client for the Arizona 511 traveler information API.

Installation

pip install az511-client

Quick Start

from az511 import AZ511Client

client = AZ511Client(api_key="your_key_here")

cameras = client.get_cameras()
for cam in cameras:
    print(cam.roadway, cam.location, cam.latitude, cam.longitude)
    for view in cam.views:
        print("  ", view.url)

Authentication

Get a free API key at https://www.az511.com/my511/register.

Pass it explicitly or set the AZ511_API_KEY environment variable:

export AZ511_API_KEY=your_key_here
# reads AZ511_API_KEY automatically from the environment
client = AZ511Client()

A .env file in the working directory is also supported (via python-dotenv):

AZ511_API_KEY=your_key_here

Available Methods

Method Returns Description
get_cameras() list[Camera] All traffic cameras
get_weather_stations() list[WeatherStation] All roadside weather stations
get_alerts() list[Alert] Active traveler alerts
get_rest_areas() list[RestArea] Rest area status and amenities
get_events() list[Event] Active traffic events and roadwork
get_message_boards() list[MessageBoard] Variable message signs (VMS)
get_wzdx() WZDxFeatureCollection Work zone data (GeoJSON, WZDx 4.x)

All model classes are importable from az511.models:

from az511.models import (
    Camera, CameraView,
    WeatherStation,
    Alert,
    RestArea,
    Event, EventRestrictions,
    MessageBoard,
    WZDxFeatureCollection, WZDxFeature, WZDxProperties,
)

Error Handling

from az511 import AZ511Client
from az511.exceptions import AuthError, RateLimitError, APIError

client = AZ511Client()

try:
    events = client.get_events()
except AuthError:
    print("Invalid API key")
except RateLimitError:
    print("Rate limit hit — wait 60 seconds and retry")
except APIError as e:
    print(f"API error {e.status_code}: {e}")

Rate Limits

The AZ511 API allows 10 requests per 60 seconds. Exceeding this raises RateLimitError (HTTP 429). The client does not throttle automatically — callers are responsible for pacing requests.

Development

git clone https://github.com/joelrberry/az511-client
cd az511-client
python -m venv .venv
.venv\Scripts\activate          # Windows
# source .venv/bin/activate     # macOS/Linux
pip install -e ".[dev]"
cp .env.example .env            # add your AZ511_API_KEY
pytest

License

MIT — see LICENSE.

Metadata

Release files for az511-client 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for az511-client 0.1.1
File Size Uploaded
az511_client-0.1.1.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for az511-client 0.1.1
File Interpreter ABI Platform
az511_client-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 25.7 kB

Release files / az511_client-0.1.1.tar.gz

Download URL az511_client-0.1.1.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ce7247208e666899749a8549fb26f379df0c64fececfdbe1fd62958dfced1397
BLAKE2b-256 checksum
How to use checksums
743da151679d4b173e7e5142acb665781f19dc70e597d9d35eeb8ad0015e1cf8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release files / az511_client-0.1.1-py3-none-any.whl

Download URL az511_client-0.1.1-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
365d761468e874b559b0e5c50ea5525d1aa89096ce97cf76b627410589c8feed
BLAKE2b-256 checksum
How to use checksums
d4d2963ccf49292f5659a896b316c3f39cf96d482d130f0bffe46ea612dafd27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page