Skip to main content

status302 — Python SDK

Official Python client for the Status302 API: real-time ticket market data (catalog, metrics, sales, seat maps) over REST, a realtime WebSocket stream and signed webhooks.

  • Typed methods for every public operation (TypedDict models generated from the public OpenAPI spec)
  • Blocking Status302 and asyncio AsyncStatus302 clients on httpx
  • Automatic retries on 429 and 5xx (idempotent requests) honouring Retry-After
  • Pagination helpers (cursors and alert nextBefore ids) and typed errors (PlanRequiredError, RateLimitError, …) carrying the response's request_id (also appended to the message as (request <id>); quote it to support)
  • Conditional requests: if_none_match with a typed NotModified result, response ETags, and an opt-in ETag cache
  • Stream client: bearer or ticket auth, reconnects with backoff, since resume per topic, resync notices, seq deduplication
  • Webhook signature verification

The package version equals the version of the public API spec it was generated from.

Install

pip install status302        # or: uv add status302

Python ≥ 3.11.

Quickstart

import os
from status302 import Status302

with Status302(api_key=os.environ["STATUS302_API_KEY"]) as status302:
    page = status302.list_events(country="US", limit=5)
    for event in page["items"]:
        print(event["id"], event["name"], event["startsAt"])

    metrics = status302.get_event_metrics(page["items"][0]["id"])
    for row in metrics["items"]:
        print(row["scope"], row["floor"], row["currency"])  # money is integer minor units

Create an API key in the app under Settings → Developers. Keys look like tx_live_<keyId>_<secret> and are sent as Authorization: Bearer ….

Pagination

for event in status302.paginate(status302.list_events, country="US", limit=200):
    ...

pages(...) yields whole pages instead. Both follow nextCursor until it is null, or nextBefore (as before) for list_alert_rules and list_alert_events.

Conditional requests

from status302 import MemoryETagCache, NotModified, Status302

first = status302.with_response.get_event_metrics(4102)          # APIResponse with .data, .etag, .status, .rate_limit
nxt = status302.get_event_metrics(4102, if_none_match=first.etag)  # types.EventMetricsList | NotModified
if isinstance(nxt, NotModified):
    print("unchanged since", nxt.etag)

cached = Status302(api_key=os.environ["STATUS302_API_KEY"], etag_cache=MemoryETagCache())

Operations that accept If-None-Match take if_none_match; a 304 returns NotModified instead of raising, and the return type includes it only when the argument is passed. with_response has every operation returning the whole APIResponse. With etag_cache the client revalidates every GET by itself and returns the stored body on 304; MemoryETagCache(max_entries=1000) is thread-safe and LRU, and any object with get/set (the ETagCache protocol) works.

Errors and rate limits

from status302 import PlanRequiredError, RateLimitError

try:
    status302.list_movers(window="24h")
except PlanRequiredError as e:
    print("needs plan", e.required_plan)
except RateLimitError as e:
    print("retry in", e.retry_after, "s; quota:", e.rate_limit)

429 responses are retried after Retry-After (up to max_retry_after, default 60 s); 5xx and connection errors are retried for idempotent methods with exponential backoff (max_retries, default 3). status302.request(...) returns the body together with status, headers, ETag and the parsed RateLimit state.

Realtime stream

import asyncio, os
from status302 import AsyncStatus302, DataMessage, ResyncMessage

async def main() -> None:
    async with AsyncStatus302(api_key=os.environ["STATUS302_API_KEY"]) as status302:
        async with status302.stream() as stream:
            stream.subscribe("sales", filter={"country": ["US"]})
            async for message in stream:
                if isinstance(message, DataMessage):
                    print(message.seq, message.data)
                elif isinstance(message, ResyncMessage):
                    snapshot = await stream.fetch_snapshot(message)

asyncio.run(main())

The key needs the stream scope to connect, and each topic the scope of its REST equivalent (event.{id}.kpis → market:read, sales/event.{id}.sales → sales:read, event.{id}.primary → maps:read or market:read, onsales → catalog:read, alerts → alerts:write); without it the subscription fails with a forbidden_topic SubscriptionError. Server-side code authenticates with the key on the upgrade request (auth="bearer", default with a key); pass auth="ticket" and get_ticket= to connect with single-use tickets instead (same scopes as the key).

Binary encoding (MessagePack)

stream(encoding="msgpack") asks the server for binary MessagePack frames (encoding=msgpack on the URL) instead of JSON text. Messages and data payloads decode to the same values as with JSON, so iteration doesn't change; the client's own messages stay JSON. Default: "json".

Webhooks

from status302 import verify_webhook, WebhookVerificationError

event = verify_webhook(raw_body, headers["Status302-Signature"], os.environ["STATUS302_WEBHOOK_SECRET"])

Versioning

Releases share the version of the API spec they were generated from (status302.__version__); /v1 changes are additive only, so new fields, operations and enum values arrive in minor releases. See the changelog.

License

MIT

Metadata

Release files for status302 1.5.0

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

Source distribution (sdist)

Source distribution for status302 1.5.0
File Size Uploaded Provenance Actions
status302-1.5.0.tar.gz 91.9 kB Without provenance Details for status302-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for status302 1.5.0
File Interpreter ABI Platform Actions
status302-1.5.0-py3-none-any.whl Python 3 none any Details for status302-1.5.0-py3-none-any.whl

Total release size: 187.3 kB

Release files / status302-1.5.0.tar.gz

Download URL status302-1.5.0.tar.gz
Size 91.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ea9e36bb2f36f164db5f2ae10df041254fcba935b166090f942db08d6c42c681
BLAKE2b-256 checksum
How to use checksums
1595d1e305a96cddd2e58db7245e7f4e04d0a6fdca5e5af48d64ed16369a7070
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / status302-1.5.0-py3-none-any.whl

Download URL status302-1.5.0-py3-none-any.whl
Size 95.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b0da939e1108c19f2c3d5017662c9bf9ff1e3aedff72cc224360e850c2d3d701
BLAKE2b-256 checksum
How to use checksums
2f53bbdc1c9a080dcfbad9094cde9fdd9d876bcb499dd4460e0ce1dd4af394ce
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for status302 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.5.0 This release

2 release files No provenance

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