Skip to main content

What is the Steadwing Python SDK?

The Steadwing Python SDK auto-captures exceptions, error logs, and HTTP breadcrumbs from your Python applications and sends them to Steadwing for root cause analysis. Add two lines of code and Steadwing starts monitoring your application no manual instrumentation required.

Auto-Capture

Unhandled exceptions, error logs, and thread crashes captured automatically

HTTP Breadcrumbs

Outgoing HTTP requests recorded with method, URL, status, and duration

FastAPI Support

Automatic route error capture with request context when FastAPI is installed

Data Scrubbing

Sensitive fields (passwords, tokens, API keys) redacted before sending

Installation

pip install steadwing
Requires Python 3.10+. View on PyPI or browse the source on GitHub.

Quick Start

Get your API key from app.steadwing.com/organization, then initialize the SDK:
import steadwing

steadwing.init(
    api_key="st_your_api_key"
)
That’s it. The SDK automatically:
  • Captures unhandled exceptions (including in threads)
  • Captures logging.error() and logging.critical() calls
  • Records outgoing HTTP requests as breadcrumbs
  • Sends heartbeats every 60 seconds
  • Patches supported frameworks to capture route errors with request context

Configuration

steadwing.init(
    api_key="st_...",           # Required: your API key
    service="my-service",       # Optional: defaults to "default"
    env="PROD",                 # Optional: defaults to "PROD"
    enabled=True,               # Optional: set False to disable
)
Only events sent with env="PROD" are considered for auto-monitoring. Events from other environments are received but will not trigger automated RCA.

Manual Capture

For cases where you want to explicitly report errors or messages:
import steadwing

# Capture a specific exception
try:
    risky_operation()
except Exception as e:
    steadwing.capture_exception(e)

# Capture the current exception (in an except block)
try:
    risky_operation()
except Exception:
    steadwing.capture_exception()

What Gets Captured

Exceptions

DataDescription
Stack traceFull trace with local variables
Exception chain__cause__ and __context__ included
BreadcrumbsLast 100 events leading up to the error
Request contextMethod, path, headers (for web framework routes)

Logs

  • logging.error() and logging.critical() are sent as events
  • All log levels are recorded as breadcrumbs for context

HTTP Breadcrumbs

Every outgoing HTTP request is recorded with:
  • Method and URL
  • Response status code
  • Request duration
  • Rolling buffer of last 100 entries

Data Scrubbing

Sensitive data is automatically scrubbed before leaving your application. Keys matching the following patterns (case-insensitive) have their values replaced with [REDACTED]:
password, passwd, secret, api_key, apikey, token, auth,
authorization, cookie, csrf, session, credit_card, ssn

Framework Support

The SDK auto-detects installed frameworks and patches them automatically. No extra configuration needed.
FrameworkWhat’s Captured
FastAPIRoute errors with full request context (method, path, headers)
DjangoMiddleware-based exception capture with request metadata
FlaskError handler integration with request context
SQLAlchemyDatabase query breadcrumbs (query, duration)
Django ORMDatabase query breadcrumbs via cursor wrapper
asyncioUnhandled exceptions in async tasks and event loops

FAQs

No. After calling steadwing.init(), the SDK hooks into Python’s exception handling and logging system automatically. Manual capture is available for cases where you want explicit control.
Minimal. Events are sent asynchronously and the SDK adds negligible overhead to your application. Breadcrumbs are stored in a fixed-size ring buffer.
Yes. Pass enabled=False to steadwing.init() and the SDK becomes a no-op no patches are installed and no events are sent.
The SDK coexists with other error trackers. It hooks into sys.excepthook and the logging module without interfering with other handlers.
Sensitive fields are scrubbed before transmission. Data is sent over HTTPS to Steadwing’s backend. See the Data Scrubbing section for details on what’s redacted.
Need help? Contact us at hello@steadwing.com