Lightweight incident reporter for Solen MetaShift webhooks (Python runtime errors)
Project description
solenai-monitor
Report runtime errors to Solen MetaShift incident webhooks from Python. Registers sys.excepthook and asyncio unhandled-exception handlers automatically. No required dependencies—stdlib only (requests optional for HTTP).
Install
pip install solenai-monitor
Optional faster HTTP backend:
pip install "solenai-monitor[requests]"
Quick setup
import solenai_monitor
solenai_monitor.init(
endpoint="https://api.solenai.ca/api/webhooks/incident/<endpointId>",
secret="<your-secret>",
)
Calling init() registers handlers for uncaught exceptions and unhandled asyncio task failures. Failures while reporting are swallowed so your app never crashes because of the monitor.
Webhook URL and secret
Create an incident webhook endpoint in the Solen dashboard:
https://solenai.ca/integrations/webhooks
Each endpoint provides:
- Webhook URL — MetaShift ingest URL (
/api/webhooks/incident/{endpointId}) - Secret — used to sign requests (
X-Solen-Signature, HMAC-SHA256 of the JSON body) and authenticate (X-Solen-Secret)
Store both in environment variables (for example SOLEN_WEBHOOK_URL and SOLEN_WEBHOOK_SECRET) and pass them to init().
Payload
On exception, the SDK POSTs JSON:
{
"source": "python",
"error": "division by zero",
"traceback": "Traceback (most recent call last):\n ...",
"timestamp": "2026-05-16T12:00:00.000000+00:00",
"hostname": "my-host"
}
Headers:
Content-Type: application/jsonX-Solen-Signature— hex HMAC-SHA256 of the raw bodyX-Solen-Secret— shared webhook secret
Manual capture
import solenai_monitor
solenai_monitor.init(endpoint=url, secret=secret)
try:
risky()
except Exception as exc:
solenai_monitor.report_exception(exc)
raise
Requirements
- Python 3.8+
- Optional:
requestsfor HTTP (falls back tourllib.request)
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 solenai_monitor-0.1.0.tar.gz.
File metadata
- Download URL: solenai_monitor-0.1.0.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
360e1e4c910bbdb8e4911be02ac8ab68358f9d8c314ff83583769b4bd831c1aa
|
|
| MD5 |
35687919b99ddb2bd81f704854965498
|
|
| BLAKE2b-256 |
fa7bed77eb682261a198b8bea508eeb6b5d17b800faf40f19bca60cdf2c71f6a
|
File details
Details for the file solenai_monitor-0.1.0-py3-none-any.whl.
File metadata
- Download URL: solenai_monitor-0.1.0-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e91c0e67a8088f8635a6f51ba5861dbd1c6911349d1005d3baea13be4dbf91df
|
|
| MD5 |
5bf1a1436038fb17b6e3f2750a4667c5
|
|
| BLAKE2b-256 |
37da1e2d5b8af1f92ae9c9d2d5b29101aea0c4da69913219cad8b6df5fca0573
|