errorgap
Python notifier for Errorgap. Captures exceptions, normalizes tracebacks with bounded source excerpts for readable frames, and ships notices to an Errorgap server. Single package covers plain Python, Django, Flask, and FastAPI.
Install
pip install errorgap
For framework integrations:
pip install "errorgap[django]" # or [flask], [fastapi]
Requires Python 3.9+.
Configure
import errorgap
errorgap.init(
endpoint=...,
project_slug=...,
api_key=...,
environment="production",
)
init reads the same values from ERRORGAP_ENDPOINT,
ERRORGAP_PROJECT_SLUG, ERRORGAP_PROJECT_ID, and ERRORGAP_API_KEY if you
don't pass them. By default it installs a sys.excepthook to catch
uncaught exceptions in scripts; pass capture_globals=False to skip.
Manual notification
try:
risky()
except Exception as exc:
errorgap.notify(exc, context={"component": "billing"})
raise
notify returns a DeliveryResult (status, body, error, queued).
The SDK never raises.
Django
Add to MIDDLEWARE:
MIDDLEWARE = [
"errorgap.django.ErrorgapMiddleware",
# ... your existing middleware ...
]
Flask
from flask import Flask
from errorgap.flask import init_app
app = Flask(__name__)
init_app(app)
FastAPI
from fastapi import FastAPI
from errorgap.fastapi import ErrorgapMiddleware
app = FastAPI()
app.add_middleware(ErrorgapMiddleware)
Configuration reference
| Argument | Default | Notes |
|---|---|---|
endpoint |
ERRORGAP_ENDPOINT or http://127.0.0.1:3030 |
Base URL, no trailing slash |
project_slug |
ERRORGAP_PROJECT_SLUG |
Required |
project_id |
ERRORGAP_PROJECT_ID |
Optional, embedded in payload |
api_key |
ERRORGAP_API_KEY |
Sent as x-errorgap-project-key |
environment |
ERRORGAP_ENVIRONMENT, ENV, or development |
|
root_directory |
os.getcwd() |
Marks application frames; readable dependency frames also include bounded source excerpts |
async_ |
True |
Background-thread delivery |
logger |
logging.getLogger("errorgap") |
Pass None to silence |
filter_keys |
("password", "token", ...) |
Substring match, case-insensitive |
capture_globals |
True |
Install sys.excepthook |
Graceful shutdown
errorgap.flush(timeout=5) # wait for queued deliveries
errorgap.shutdown(timeout=5) # flush + tear down background thread
Verify
curl -sS -X POST "$ERRORGAP_ENDPOINT/api/projects/$ERRORGAP_PROJECT_SLUG/notices" \
-H "content-type: application/json" \
-H "x-errorgap-project-key: $ERRORGAP_API_KEY" \
-d '{"errors":[{"type":"ErrorgapInstallTest","message":"Errorgap install verification"}],"context":{"environment":"development"}}'
Then trigger a real error and confirm it appears in the Errorgap UI.
Development
python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
pytest
License
MIT.
Release files for errorgap 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| errorgap-0.1.1.tar.gz | 13.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| errorgap-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.9 kB
Release files / errorgap-0.1.1.tar.gz
| Download URL | errorgap-0.1.1.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d8cee24b4a6e2febdd956ea9864142cd69643fc6e1fce91a7671f6527d7bc4a1
|
|
BLAKE2b-256 checksum How to use checksums |
cf48543f61d7ea8f3347c821dcce857550883bfce3cfbefb12b09c0627f52630
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency logRelease files / errorgap-0.1.1-py3-none-any.whl
| Download URL | errorgap-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
670f344515484ecac33a1d20c09949ab49b0f49ddd0a6e9c7fb76121ac98815e
|
|
BLAKE2b-256 checksum How to use checksums |
b7d994c94c11d13794331fe6eb210e059592cf93d1a5e3a46f0efbc6bb573a07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jul 18, 2026.
Transparency log