Skip to main content

Production-ready Python SDK for eSauti — REST API + Event Injection

Project description

eSauti Python SDK

Production-ready Python SDK for eSauti. Supports both the REST API and the Event Injection API.

Requirements

  • Python 3.10+
  • requests >= 2.25

Installation

pip install esauti

Or from source:

git clone https://github.com/esauti/pyesauti
cd pyesauti
pip install -e ".[dev]"

Quick Start

REST API

from esauti import EsautiClient

client = EsautiClient(
    base_url="https://your-instance.esauti.com/api",
    token="YOUR_BEARER_TOKEN",
)

# List contacts
contacts = client.api.contacts.list(limit=10)
print(contacts)

# Create a contact
contact = client.api.contacts.create({"firstname": "Jane", "email": "jane@esauti.com"})
print(contact)

Event Injection

from esauti import EsautiClient
from esauti.events import EventType

client = EsautiClient(
    base_url="https://your-instance.esauti.com",
    token="YOUR_BEARER_TOKEN",
)

receipt = client.events.send(
    EventType.CUSTOMER_CREATED,
    identity={"id": "cus_123", "email": "jane@esauti.com"},
    data={"status": "active"},
    source="my-app",
)
print(receipt)

HMAC Signing

from esauti import EsautiClient

client = EsautiClient(
    base_url="https://your-instance.esauti.com",
    token="YOUR_BEARER_TOKEN",
    hmac_secret="your-hmac-secret",
)

receipt = client.events.send(
    "order.created",
    identity={"id": "cus_456"},
    data={"value": 99.99, "currency": "USD"},
    source="shopify",
)

Configuration

client = EsautiClient(
    base_url="https://...",
    token="...",
    hmac_secret=None,           # optional HMAC secret for event signing
    timeout=30.0,               # request timeout in seconds
    max_retries=3,              # max retry attempts
    debug=False,                # enable debug logging
    redact_pii=False,           # redact email/phone in logs
    events_endpoint="/api/integrations/events",  # override events URL
    source="sdk",               # X-eSauti-Source header value
)

Running Tests

pip install -e ".[dev]"
pytest

Project Structure

src/esauti/
├── __init__.py         # Public API
├── client.py           # EsautiClient entrypoint
├── auth.py             # BearerAuth, HmacAuth, CompositeAuth
├── transport.py        # HttpTransport abstraction + requests impl
├── retry.py            # RetryPolicy with exponential backoff + jitter
├── exceptions.py       # ApiError, EventValidationError
├── _logging.py         # Redacting structured logger
├── deadletter.py       # DeadLetter sink (JSONL file or custom hook)
├── api/
│   ├── __init__.py
│   └── client.py       # OpenAPI module (contacts, campaigns, etc.)
└── events/
    ├── __init__.py
    ├── registry.py     # EventType enum + registry loader
    ├── builder.py      # Event envelope builder + validator
    └── client.py       # EventsClient (build / send)

Documentation

Document Description
01 – Installation & Setup Requirements, pip install, environment variables
02 – Getting Started Your first API call and first event in 5 minutes
03 – Authentication Bearer tokens, API keys, HMAC signing
04 – REST API Module Contacts, campaigns, forms and all resource methods
05 – Events Module Building, validating and sending canonical events
06 – Event Types Reference All 225 canonical event type constants
07 – Error Handling ApiError, TransportError, EventValidationError
08 – Reliability Retry policy, dead-letter sink, idempotency
09 – Logging Debug logging, PII redaction
10 – Advanced Custom transport, testing, multi-tenant usage

Changelog

See CHANGELOG.md.

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

esauti-1.0.1.tar.gz (38.6 kB view details)

Uploaded Source

Built Distribution

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

esauti-1.0.1-py3-none-any.whl (37.6 kB view details)

Uploaded Python 3

File details

Details for the file esauti-1.0.1.tar.gz.

File metadata

  • Download URL: esauti-1.0.1.tar.gz
  • Upload date:
  • Size: 38.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for esauti-1.0.1.tar.gz
Algorithm Hash digest
SHA256 65cfa82cb04848d9f090241658f58d5c3e7b057c7c871a669de05814d9ddd6c6
MD5 8035f88c55d737f466d12c33cca6086a
BLAKE2b-256 cd1e11c90dbc4855597a8489163d332d1f6b4c31c76b93bfc4ac1f1bf358125e

See more details on using hashes here.

File details

Details for the file esauti-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: esauti-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 37.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for esauti-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bf8f192f38d6fecb5f69e9a2a7a58db2b6854bdd8ad9cc373c6d88fe09ff01ce
MD5 b718ca7ec5d089b1b747db6b67ed77e2
BLAKE2b-256 fe36f23bece5094a7a98f70b42fd7d80eaaf32e5df46042400673cc79fc5634b

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