The g8scope package turns a Python exception into an envelope with the standard traceback module and sends it over HTTPS with the standard library. It has no dependencies and supports Python 3.8+. The Django, Flask and FastAPI adapters build on it.
Install from GitHub. Not on PyPI yet. Source: github.com/bliptrace/bliptrace-python.
Install
pip install "g8scope @ git+https://github.com/bliptrace/bliptrace-python"
In requirements.txt: g8scope @ git+https://github.com/bliptrace/bliptrace-python
Use it
import os
from g8scope import Client, Config
client = Client(Config(
key=os.environ.get("BLIPTRACE_KEY"),
endpoint="https://ingest.bliptrace.com",
environment="production",
release="[email protected]",
base_path="/srv/app", # frames under here are in-app
scrub_keys=["password", "token", "authorization"],
ignore_exceptions=[KeyboardInterrupt], # classes or class-name strings
))
try:
do_something_risky()
except Exception as exc:
client.capture(exc, context={
"request": {"method": "POST", "url": "/checkout"},
"user": {"id": "u_123"},
"custom": {"order_id": "ord_42"},
})
| Option | Default | |
|---|---|---|
key |
None |
Nothing is sent without it |
endpoint |
legacy host | Set https://ingest.bliptrace.com |
environment |
production |
|
release |
None |
|
timeout |
3 |
Seconds |
max_frames / max_message |
30 / 2000 |
|
ignore_exceptions |
[] |
|
scrub_keys |
[] |
Case-insensitive, recursive |
base_path |
"" |
Files under it and outside site-packages are in-app |
enabled |
True |
To send later (after a response), split it: envelope = client.build_envelope(exc, context) then client.send_envelope(envelope).