Python SDK
emitwave — a server-side SDK that HMAC-signs and publishes events to the gateway.
Server SDK· 3 min read
Install
bash
pip install emitwave
Requires Python 3.9+, an application ID, and an active server credential (public key + one-time secret). Keep the secret on the server — never in client code, public env vars, logs, or API responses.
The
key and secret are a server credential, not the browser public application key. For every request the SDK hashes the exact JSON body and signs the method, path, canonical query, and body hash with HMAC-SHA256 — the same protocol as every other EmitWave server SDK.Publish an event
trigger(channel, event, data) serializes the event, signs the body, and sends it to /apps/{app_id}/events. gateway_url is optional and defaults to the live gateway.
publish.py
from emitwave import Client, Config client = Client(Config( app_id="app_...", key="ew_pk_live_...", # server credential public key secret="ew_sk_live_...", # server credential secret # gateway_url defaults to https://api.emitwave.com )) client.trigger("orders", "order.created", {"id": "ord_123", "total": 4900})
Error handling
EmitwaveError represents a non-2xx gateway response and carries .status and .body; the body never includes your secret.
errors.py
from emitwave import Client, Config, EmitwaveError try: client.trigger("orders", "order.created", {"id": "ord_123"}) except EmitwaveError as e: print("Emitwave rejected the event", e.status, e.body)
This SDK publishes the provided JSON as-is. It does not build the ciphertext envelope for a private-encrypted channel — see Encryption.