FastAPI Integration
The FastAPI integration provides automatic error capture and request context for all endpoints.Installation
First, install with FastAPI support:Setup with Middleware
1
Initialize the SDK
Initialize Proliferate early in your application startup, before creating the FastAPI app:
2
Add Middleware
Add
ProliferateMiddleware to your FastAPI app:3
Add Context in Routes
Set user and account context in your route handlers:
Complete FastAPI Example
main.py
What’s Captured Automatically
The FastAPI middleware automatically captures:Request Context
Request Context
- Method: HTTP method (GET, POST, etc.)
- URL: Full request URL including query parameters
- Path: Request path (e.g.,
/api/checkout) - Headers: Request headers (sensitive headers filtered)
- Query Parameters: Parsed query string parameters
- Client IP: Original client IP (handles
X-Forwarded-Forproxy headers) - Request ID: Generated UUID or from
X-Request-ID/X-Correlation-IDheader
Sensitive Header Filtering
Sensitive Header Filtering
These headers are automatically filtered from error reports:
authorizationcookieset-cookiex-api-keyapi-keyx-auth-tokenx-csrf-tokenx-xsrf-token
Exception Details
Exception Details
- Exception Type: Full module path (e.g.,
stripe.error.CardError) - Message: Exception message
- Stack Trace: Complete Python traceback
- Timestamp: UTC timestamp of the error
Flask Integration
The Flask integration provides the same automatic error capture for Flask applications.Setup
1
Initialize the SDK
2
Initialize Flask Integration
3
Add Context in Routes
Complete Flask Example
app.py
Alternative: Class-based Flask Extension
For the Flask application factory pattern:Other ASGI/WSGI Frameworks
For frameworks not directly supported, you can manually capture errors:Django Example
settings.py
middleware.py

