---
title: Python SDK
description: "Send Cuitty events from Python — sync or async, with built-in batching and HMAC signing."
section: SDK
order: 2
updatedAt: 2026-04-27
slug: sdk/python
---
# Python SDK

> **Status: Preview.** The Python SDK is on the Phase 3 roadmap. Until it ships you can use [the wire protocol directly](/docs/reference/wire-protocol) — every Python HTTP client supports the small surface area required.

## Planned API

```python
from cuitty import Client

c = Client(
    portal_url="https://app.cuitty.com",
    project_id=PROJECT_ID,
    api_key=API_KEY,
)

c.audit(
    actor="alice@example.com",
    action="secret.rotate",
    resource="stripe.live_key",
)

c.flush()
```

## Wire-protocol equivalent today

```python
import hmac, hashlib, json, os, time
import urllib.request

body = json.dumps({
    "events": [{
        "type": "audit",
        "ts": time.strftime("%Y-%m-%dT%H:%M:%SZ", time.gmtime()),
        "data": {"actor": "alice@example.com",
                 "action": "secret.rotate",
                 "resource": "stripe.live_key"},
    }],
}).encode()

sig = hmac.new(os.environ["CUITTY_WEBHOOK_SECRET"].encode(),
               body, hashlib.sha256).hexdigest()

req = urllib.request.Request(
    "https://app.cuitty.com/api/ingest",
    data=body,
    headers={
        "Authorization": f"Bearer {os.environ['CUITTY_API_KEY']}",
        "Content-Type": "application/json",
        "X-Cuitty-Signature": sig,
    },
)
print(urllib.request.urlopen(req).read())
```

## Live performance numbers

See live benchmarks at [https://benchmarks.cuitty.com/sdks/python](https://benchmarks.cuitty.com/sdks/python).

## See also

- [Wire protocol](/docs/reference/wire-protocol)
- [SDK parity & divergence](/docs/sdk/parity)