AutoTrace Python SDK (autotrace-py)
Lightweight, zero-dependency Python client for autonomous error tracking and AI triage with AutoTrace.
Installation
pip install autotrace
# or from source:
pip install -e ./sdk/python
Quickstart
import autotrace
# 1. Initialize once at application startup
autotrace.init(
api_key="<YOUR_API_KEY>",
endpoint_url="http://localhost:8000/api/ingest/",
environment="production",
context={"service": "payment-api", "version": "2.1.0"},
)
# 2. Manual Exception Capture
try:
process_order()
except Exception as exc:
autotrace.capture_exception(
exc_info=exc,
endpoint="/api/v1/orders",
context={"user_id": "usr_123"},
)
Function Decorator
@autotrace.trace(endpoint="/jobs/sync-inventory")
def sync_inventory():
# If this raises, AutoTrace captures the error and traceback
perform_risky_task()
Framework Integrations
Django
In your settings.py:
AUTOTRACE_API_KEY = "<YOUR_API_KEY>"
AUTOTRACE_ENDPOINT = "http://localhost:8000/api/ingest/"
MIDDLEWARE = [
# ... other middleware
"autotrace.integrations.django.AutoTraceMiddleware",
]
FastAPI / Starlette
In your main.py:
from fastapi import FastAPI
import autotrace
from autotrace.integrations.fastapi import AutoTraceMiddleware
autotrace.init(api_key="<YOUR_API_KEY>")
app = FastAPI()
app.add_middleware(AutoTraceMiddleware)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
autotrace_py-0.1.0.tar.gz
(10.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autotrace_py-0.1.0.tar.gz.
File metadata
- Download URL: autotrace_py-0.1.0.tar.gz
- Upload date:
- Size: 10.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
324cce80258c3186bf885fb9b77d23aa61acc6b1255f6e186d23ea6d0a18e765
|
|
| MD5 |
975e25b9f92ab8d5b7fd3e59a15a0624
|
|
| BLAKE2b-256 |
1a570e2cba259ba6307a33ab93c3683b243f1110f9ad4916864840d74ffa1fb1
|
File details
Details for the file autotrace_py-0.1.0-py3-none-any.whl.
File metadata
- Download URL: autotrace_py-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
165f417b5dacbd6c153d0826deef6ca97ae7cb137c818e3b47661aaa9522ef8b
|
|
| MD5 |
660ed90322a9652ef695f8d32235e2ab
|
|
| BLAKE2b-256 |
daa98b378626bf9dd2b996d11260371ebcd63e78dfa878de74ff6561881d14f6
|