Use errova-sdk for Python services, workers, and scripts. For backend workloads, server-signed DSNs are the default recommendation because the SDK can sign requests automatically when dsn_secret is present.
pip install errova-sdk
1. Initialize the SDK
from errova_sdk import capture_message, flush, initinit(dsn="https://ingest.example.com/ingest/<public_key>/events",dsn_secret="<one-time-secret-from-key-create>",environment="production",release="my-service@1.0.0",)capture_message("python sdk quickstart: server_signed", level="warning")flush(timeout=2.0)
2. Redact Sensitive Fields Before Transport
from errova_sdk import initSENSITIVE_CONTEXT_KEYS = {"password", "token", "authorization", "ssn"}def redact(event):context = event.get("context")if isinstance(context, dict):for key in list(context.keys()):if str(key).lower() in SENSITIVE_CONTEXT_KEYS:context[key] = "[REDACTED]"user = event.get("user")if isinstance(user, dict) and "email" in user:user["email"] = "[REDACTED]"return eventinit(dsn="https://ingest.example.com/ingest/<public_key>/events",before_send=redact,)
3. Forward Python Logging Records
import loggingfrom errova_sdk import ErrovaLoggingHandlerlogger = logging.getLogger("app")logger.setLevel(logging.INFO)logger.addHandler(ErrovaLoggingHandler(level=logging.ERROR))
Verification and Runtime Notes
- Run
python3 tests/verify_local.pyfrom the SDK package when you want the full local verification gate. - The SDK adds
X-Errova-Timestamp,X-Errova-Nonce, andX-Errova-Signatureautomatically whendsn_secretis set. - The transport uses a background daemon thread, retries transient failures with backoff, and honors
Retry-Afteron429responses. - Use
flush(timeout=2.0)andclose()in short-lived jobs if the process may exit before the normal flush cycle completes. - Review SDK Burst Guard if duplicate noise becomes a problem.