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
Quick Start
Get your API key from app.steadwing.com/organization, then initialize the SDK:- Captures unhandled exceptions (including in threads)
- Captures
logging.error()andlogging.critical()calls - Records outgoing HTTP requests as breadcrumbs
- Sends heartbeats every 60 seconds
- Patches supported frameworks to capture route errors with request context
Configuration
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:- Capture Exception
- Capture Message
What Gets Captured
Exceptions
| Data | Description |
|---|---|
| Stack trace | Full trace with local variables |
| Exception chain | __cause__ and __context__ included |
| Breadcrumbs | Last 100 events leading up to the error |
| Request context | Method, path, headers (for web framework routes) |
Logs
logging.error()andlogging.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]:
Framework Support
The SDK auto-detects installed frameworks and patches them automatically. No extra configuration needed.| Framework | What’s Captured |
|---|---|
| FastAPI | Route errors with full request context (method, path, headers) |
| Django | Middleware-based exception capture with request metadata |
| Flask | Error handler integration with request context |
| SQLAlchemy | Database query breadcrumbs (query, duration) |
| Django ORM | Database query breadcrumbs via cursor wrapper |
| asyncio | Unhandled exceptions in async tasks and event loops |
FAQs
Do I need to change my code?
Do I need to change my code?
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.What's the performance impact?
What's the performance impact?
Minimal. Events are sent asynchronously and the SDK adds negligible overhead to your application. Breadcrumbs are stored in a fixed-size ring buffer.
Can I disable it in development?
Can I disable it in development?
Yes. Pass
enabled=False to steadwing.init() and the SDK becomes a no-op no patches are installed and no events are sent.How does it work with existing error tracking (Sentry, etc.)?
How does it work with existing error tracking (Sentry, etc.)?
The SDK coexists with other error trackers. It hooks into
sys.excepthook and the logging module without interfering with other handlers.Is my data secure?
Is my data secure?
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.