Python SDK
The zeridion-flare package is published on PyPI and follows the same wire contract as every other Flare SDK.
pip install zeridion-flare
Requires: Python 3.10+ · httpx>=0.27 (declared as a dependency; pip installs it for you).
Type hints
The SDK is fully typed using Python 3.10+ union syntax (str | None, dict[str, Any]) — no Optional[...] / Union[...] imports needed. Method signatures, dataclass fields, and exception attributes all carry runtime-checkable annotations, so mypy / pyright / your IDE will flag drift without you re-typing anything.
Current API surface
The client exposes flat methods (one per endpoint) rather than nested namespaces, and returns plain dict payloads matching the wire format.
from zeridion_flare import FlareClient
flare = FlareClient(api_key="zf_live_sk_...")
# Enqueue a job — optional request_id / idempotency_key are accepted per call.
# - idempotency_key dedupes a replayed write (same key + same body → original response).
# - request_id is a log-correlation hint (your trace ID flows into Zeridion's logs);
# omit it and the server returns a generated ULID in the response X-Request-Id header.
job = flare.create_job(
job_type="SendWelcomeEmail",
payload={"email": "alice@example.com", "name": "Alice"},
queue="default",
max_attempts=3,
)
print(job["id"], job["state"]) # "job_abc123", "pending"
# Get job status
detail = flare.get_job(job["id"])
# List jobs (returns a dict with "jobs" + "has_more" + "next_cursor")
page = flare.list_jobs(state="failed", limit=25)
for j in page["jobs"]:
print(j["id"], j["state"])
# Cancel / retry
flare.cancel_job(job["id"])
flare.retry_job(job["id"])
Constructor options
| Keyword | Default | Description |
|---|---|---|
api_key | os.environ["FLARE_API_KEY"] | Required — pass directly or via env var. |
base_url | https://api.zeridion.com | Override for dev / staging. |
max_retries | 3 | Maximum retry attempts on 429 / 5xx / network errors. Set 0 to disable. |
retry_base_delay_ms | 500 | Base for the exponential backoff schedule. |
retry_max_delay_ms | 30000 | Cap on a single backoff wait (and on Retry-After). |
max_response_bytes | 10 * 1024 * 1024 (10 MiB) | Hard cap on response body size; protects against an unbounded body. Set 0 to disable. |
Typed error hierarchy
The following are importable from zeridion_flare:
| Class | HTTP | When it fires |
|---|---|---|
FlareError | — | Base class for every SDK exception |
AuthError | 401 | Missing / invalid / revoked API key |
QuotaError | 402 | Daily quota exceeded for the project |
NotFoundError | 404 | Resource doesn't exist (or returns None on GETs) |
ConflictError | 409 | Idempotency or invalid-state conflict |
RateLimitError | 429 | Rate-limited; inspect .retry_after, .limit, .remaining |
Webhook verification
from zeridion_flare import verify_webhook
verify_webhook(payload=request_body, header=request.headers["zeridion-signature"], secret=...)
Planned features
- Built-in worker loop (
def execute(payload: dict)handlers, sync today; async variant tracked separately if there is demand) - Recurring job support
- Custom tags + progress reporting
The synchronous client is what ships today. There is no
AsyncFlareClienton the immediate roadmap — ifasynciosupport is a hard requirement for your stack, wrapFlareClientcalls inasyncio.to_thread()for now and tell us via GitHub issues, which will prioritise a native async client.
See also
- SDKs overview — feature parity matrix
- Quick Start — Python tab in the quickstart
- REST API reference — underlying HTTP API if you need more control