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="https://autotrace-backend.onrender.com/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_API_URL = "https://autotrace-backend.onrender.com/api/ingest/"
MIDDLEWARE = [
# ... other middleware
"autotrace.middleware.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)
Metadata
Release files for autotrace-py 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autotrace_py-0.1.2.tar.gz | 9.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autotrace_py-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.7 kB
Release files / autotrace_py-0.1.2.tar.gz
| Download URL | autotrace_py-0.1.2.tar.gz |
|---|---|
| Size | 9.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8698f949ca21b4e5eee0c20e530cb91974d2553309dddd872a2356817278fd6a
|
|
BLAKE2b-256 checksum How to use checksums |
28a6e0c3f23912ac6e0ccecef550eb570f6e1d855c6a97f91c5db6785f67683d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.0
|
Release files / autotrace_py-0.1.2-py3-none-any.whl
| Download URL | autotrace_py-0.1.2-py3-none-any.whl |
|---|---|
| Size | 10.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2116d4bf1b911c61ed692aa3da6ebc365d2576be5a53ed328123f0328582184e
|
|
BLAKE2b-256 checksum How to use checksums |
59618ad80956de096b90c35e96a8e7eb2f3a81f8d6c676c101e9bd9d292f9342
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.10.0
|