NZR Autofix Python SDK
Capture Python exceptions and send them to NZR Manager for AI-powered diagnosis and auto-fix.
Installation
pip install nzr-autofix
Quick Start
import nzr_autofix
nzr_autofix.init(dsn="https://your-server.com/api/autofix/ingest/")
# Unhandled exceptions are captured automatically via sys.excepthook
Django Integration
Add the middleware to automatically capture all unhandled view exceptions and 500 errors:
# settings.py
MIDDLEWARE = [
'nzr_autofix.integrations.django.AutofixMiddleware',
# ...other middleware
]
The middleware also connects to Django's got_request_exception signal to capture all 500 responses.
Celery Integration
Capture Celery task failures:
# celery.py
from nzr_autofix.integrations.django import setup_celery_hooks
setup_celery_hooks()
Manual Capture
try:
risky_operation()
except Exception as e:
nzr_autofix.capture_exception(e)
# Or capture a message
nzr_autofix.capture_message("Something unexpected happened")
Configuration
nzr_autofix.init(
dsn="https://your-server.com/api/autofix/ingest/",
environment="production",
release="1.2.3",
capture_locals=True,
sanitize_patterns=["password", "secret", "token"],
before_send=lambda event: event, # return None to drop
)
License
MIT
Release files for nzr-autofix 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| nzr_autofix-0.1.0.tar.gz | 7.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| nzr_autofix-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.4 kB
Release files / nzr_autofix-0.1.0.tar.gz
| Download URL | nzr_autofix-0.1.0.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fb7a2149d725195160392c79847c7ab3aee7be4dc6842f66222a6ffc2e87df34
|
|
BLAKE2b-256 checksum How to use checksums |
ed3544e3940c0e7ce450906828e0de1da1028cdb1d8966abc4aab39abf403efc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|
Release files / nzr_autofix-0.1.0-py3-none-any.whl
| Download URL | nzr_autofix-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c0be67d9790992598273345bec55b7e4a79db8c0689ac8f21bc5da76d5933c90
|
|
BLAKE2b-256 checksum How to use checksums |
e670f447f998b7e6cdd8bcb77f052cff1ad19eef01609031e25763224e8910ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.10
|