Skip to main content

Python client for the Arizona 511 traveler information API

Project description

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/yourname/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.

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

az511_client-0.1.0.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

az511_client-0.1.0-py3-none-any.whl (11.1 kB view details)

Uploaded Python 3

File details

Details for the file az511_client-0.1.0.tar.gz.

File metadata

  • Download URL: az511_client-0.1.0.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for az511_client-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a02a1355529d60ae68f7064c6ccd5eae291f86b781ddc110de2ec1316108f71c
MD5 9be21aae6337b20c1e234c03c81edc74
BLAKE2b-256 bb015fb87c08365f277dcf44c5b7fc37576be7dcfe1da89812bf6f45a8c2a520

See more details on using hashes here.

File details

Details for the file az511_client-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: az511_client-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.13

File hashes

Hashes for az511_client-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce34494a8be5b67e2655f2561757a9829f244a251378ea3e964b6fe6cb139c91
MD5 01a857a6f0da073db184033c1167ba10
BLAKE2b-256 a96117ed4e8214e0204d5814eb4a9ebadcca3fef018a1aa71f596809511081d3

See more details on using hashes here.

Supported by

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