NZR Autofix SDK — capture errors and send to NZR Manager for AI-powered diagnosis and auto-fix
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 nzr_autofix-0.1.0.tar.gz.
File metadata
- Download URL: nzr_autofix-0.1.0.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fb7a2149d725195160392c79847c7ab3aee7be4dc6842f66222a6ffc2e87df34
|
|
| MD5 |
29e0189eb37ae0b58201aa7a6bb28fab
|
|
| BLAKE2b-256 |
ed3544e3940c0e7ce450906828e0de1da1028cdb1d8966abc4aab39abf403efc
|
File details
Details for the file nzr_autofix-0.1.0-py3-none-any.whl.
File metadata
- Download URL: nzr_autofix-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.8.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0be67d9790992598273345bec55b7e4a79db8c0689ac8f21bc5da76d5933c90
|
|
| MD5 |
3fbd6cce19ac17a5b4736b2b93931e1f
|
|
| BLAKE2b-256 |
e670f447f998b7e6cdd8bcb77f052cff1ad19eef01609031e25763224e8910ea
|