Skip to main content

Official Python SDK for the AI Law Tracker API — audited AI-regulation data (US state + federal, EU, global) in three lines.

Project description

AI Law Tracker — Python SDK

PyPI Python License: MIT

Official Python client for the AI Law Tracker API — the audited dataset of AI regulation across US state + federal, the EU, and global jurisdictions. Laws, news, changelogs, obligations, penalties, compliance assessment, deadlines, and webhooks.

pip install ai-law-tracker

Quick start (3 lines)

from ai_law_tracker import Client

alt = Client()                          # anonymous tier; no key required
laws = alt.laws.list(scope="federal")   # -> a Page of records
for law in laws:
    print(law["identifier"], "—", law["title"])

Authentication

The API has a free anonymous tier (rate-limited by IP). For higher limits, richer fields, and the changelog/webhook endpoints, use a free API key (no card required):

from ai_law_tracker import Client

# 1) Issue a free key by email (anonymous call is fine)
Client().account.create_key("you@example.com")   # emails you a key

# 2) Use it — explicitly, or via the ALT_API_KEY env var
alt = Client(api_key="alt_live_...")
print(alt.account.get())   # your tier, limits, and live usage

Set ALT_API_KEY in your environment and Client() picks it up automatically. Paid tiers ($29 / $99 / $299 a month) raise quotas and unlock Pro-only endpoints — see https://ai-law-tracker.com/pricing.

Pagination

List endpoints return a Page you can iterate, index, and len(), plus .total, .limit, .offset, and .has_more:

page = alt.laws.list(scope="state", jurisdiction="colorado", limit=50)
print(page.total, "records match;", len(page), "on this page")

To sweep every matching record without managing offsets yourself, use .iterate(...) — it pages transparently and yields one record at a time:

for law in alt.laws.iterate(scope="eu", in_force=True):
    ...

for hit in alt.search.iterate("facial recognition", scope="state"):
    ...

Endpoints

Grouped as resources on the client:

Resource Methods
alt.laws list, iterate, get(id), history(id), sources(id), citations(id)
alt.search query(q, ...), iterate(q, ...)
alt.news list, iterate
alt.changes list, iterate (poll since= for what changed)
alt.feed list (lean recent-changes stream)
alt.jurisdictions list, countries, states
alt.sectors list, get(sector)
alt.compliance obligations, penalties, assess, report
alt.deadlines list (JSON or iCal via format="ical")
alt.bills list, get(slug)
alt.webhooks list, get(id), create, delete (Pro+)
alt.account get, revoke, create_key(email), create_token(email)
top level alt.health(), alt.accuracy(), alt.categories(), alt.openapi()

Examples:

# Poll the changelog for everything that moved since a timestamp
changes = alt.changes.list(since="2026-07-01T00:00:00Z", scope="federal")

# Compliance obligations for a sector + jurisdiction
obs = alt.compliance.obligations(jurisdiction="colorado", sector="hr")

# Risk assessment from a company profile
result = alt.compliance.assess(state="CA", sector="hr", aiUse="resume_screening")

# Upcoming compliance deadlines as an iCal feed (text/calendar)
ics = alt.deadlines.list(scope="eu", format="ical")

Error handling

Every non-2xx response raises a typed exception carrying .status, .code, .message, and .docs:

from ai_law_tracker import NotFoundError, RateLimitError, AuthenticationError

try:
    alt.laws.get("does-not-exist")
except NotFoundError as e:
    print(e.code, e.message)
except RateLimitError as e:
    print("retry after", e.retry_after, "seconds")

All inherit from ALTError. Transient failures (timeouts, 5xx, 429) on GET/DELETE are retried automatically with exponential backoff (configurable via Client(max_retries=...)).

Configuration

Client(
    api_key=None,        # or set ALT_API_KEY
    base_url="https://ai-law-tracker.com/api/v1",
    timeout=30.0,        # seconds
    max_retries=2,       # transient GET/DELETE retries
)

Client is a context manager (with Client() as alt: ...) and has .close() to release the connection pool.

Responsible use

This SDK is designed to be a well-behaved API citizen and does not provide any way to bypass the server's tier gating or rate limits:

  • Requests are sequential with a single connection — no parallel fan-out or concurrent request flooding.
  • Retries are conservative: a small default (max_retries=2), exponential backoff with jitter, and only on idempotent GET/DELETE. Writes/POSTs are never retried automatically.
  • 429 responses and their Retry-After header are respected; a persisted rate limit surfaces as a RateLimitError (with .retry_after) rather than being retried away.
  • iterate(...) pages one page at a time, in order, through the same rate-limited transport. It is a convenience for legitimate paging, not a bulk scraper — please honour your tier's quotas.

If you need high-volume or bulk access, use an appropriate paid tier or contact hello@ai-law-tracker.com rather than working around the limits.

Links

License

MIT (SDK code). API data is CC BY 4.0 — attribution required, informational only, not legal advice.

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

ai_law_tracker-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

ai_law_tracker-0.1.0-py3-none-any.whl (15.2 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ai_law_tracker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 72c4d3c5ae154837ce0d3ce8f17ab90a787988609caf875101f0ef1af4611491
MD5 f1ddebfdc2539804ce629017dbaab250
BLAKE2b-256 50b1b2c2de9742acaef5e743e70c36068b1144e9ead99594a5e58a5bc0516851

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ai_law_tracker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 54c62601d7e5e98300a47bc29c3a1b6bfd4de22b7d6318281862e12f01895273
MD5 63caecba2176d892b63a355459ac5236
BLAKE2b-256 99117a03d9cbdbfb45eaf9174758d768f0c48d13adab3a1a1381f1d80777bac2

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