Skip to Content
SdksPython SDK

Python SDK

asiri-sdk is the official Python client for the Asiri API. It uses the Python standard library, injects API-key bearer auth, handles JSON requests, and raises typed AsiriError instances for API error envelopes.

Installation

pip install asiri-sdk

Usage

from asiri import AsiriClient, AsiriError asiri = AsiriClient( base_url="https://api.asiri.ng", api_key="sk_live_...", ) try: overview = asiri.get("/v1/reports/overview") except AsiriError as exc: print(exc.code, exc.status, exc.request_id) else: print(overview)

Mutating requests

Pass an idempotency key on POST, PUT, PATCH, and DELETE requests so retries are safe:

asiri.post( "/v1/reports/build", json_body={"type": "audit_summary", "format": "json"}, idempotency_key="retry-safe-key", )

Webhooks

The package exports AsiriWebhookEnvelope for version-aware subscriber handlers:

from asiri import AsiriWebhookEnvelope event = AsiriWebhookEnvelope( event_version=1, event_type="dsr.created", event_id="evt_123", occurred_at="2026-05-15T12:00:00.000Z", tenant_id="tenant_123", data={"request_id": "dsr_123"}, )

For endpoint paths, request bodies, and response shapes, use the API reference.