Python Setup

Install the Errova Python SDK, initialize signed ingest, redact sensitive fields, and verify delivery locally.

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.

Bash
pip install errova-sdk

1. Initialize the SDK

Python
from errova_sdk import capture_message, flush, init
init(
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

Python
from errova_sdk import init
SENSITIVE_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 event
init(
dsn="https://ingest.example.com/ingest/<public_key>/events",
before_send=redact,
)

3. Forward Python Logging Records

Python
import logging
from errova_sdk import ErrovaLoggingHandler
logger = logging.getLogger("app")
logger.setLevel(logging.INFO)
logger.addHandler(ErrovaLoggingHandler(level=logging.ERROR))

Verification and Runtime Notes

  • Run python3 tests/verify_local.py from the SDK package when you want the full local verification gate.
  • The SDK adds X-Errova-Timestamp, X-Errova-Nonce, and X-Errova-Signature automatically when dsn_secret is set.
  • The transport uses a background daemon thread, retries transient failures with backoff, and honors Retry-After on 429 responses.
  • Use flush(timeout=2.0) and close() 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.