Skip to content

Python connection

Connect Python sites to ErrorNotifier

Use environment variables and copy-paste samples to send backend Python exceptions into ErrorNotifier. No Python ZIP download is published from the site; install the local package from your approved source tree or use the raw HTTPS fallback.

Credential modelEnvironment Variables
Use ERRORNOTIFIER_PROJECT_KEY for normal error events. Use ERRORNOTIFIER_SERVER_KEY only for trusted backend automation that needs protected release, deploy, artifact, or CI routes.
Ingest endpointPOST /store
Python events post to https://errornotifier.com/wp-json/errornotifier/v1/store and use the same event shape as browser, PHP, Node, and envelope ingestion.
Samples onlyNo ZIP Download
The page gives connection samples and API guidance. It does not publish a Python package ZIP from ErrorNotifier.com.
.NET parityShared Variables
The ErrorNotifier.Extensions.Logging NuGet package reads the same ERRORNOTIFIER_* environment variables so Python and .NET services can share deployment settings.
PII boundaryScrubbed Server Side
ErrorNotifier still applies payload caps and common token, password, authorization, card-like value, and email-address scrubbing after receipt.

1. Set environment variables

# PowerShell
$env:ERRORNOTIFIER_PROJECT_KEY = "enpk_your_public_project_key"
$env:ERRORNOTIFIER_ENDPOINT = "https://errornotifier.com/wp-json/errornotifier/v1/store"
$env:ERRORNOTIFIER_BASE_URL = "https://errornotifier.com"
$env:ERRORNOTIFIER_ENVIRONMENT = "production"
$env:ERRORNOTIFIER_SERVICE_NAME = "billing-worker"
$env:ERRORNOTIFIER_RELEASE = "billing-2026.06.09.1"

# Linux/macOS shell
export ERRORNOTIFIER_PROJECT_KEY="enpk_your_public_project_key"
export ERRORNOTIFIER_ENDPOINT="https://errornotifier.com/wp-json/errornotifier/v1/store"
export ERRORNOTIFIER_BASE_URL="https://errornotifier.com"
export ERRORNOTIFIER_ENVIRONMENT="production"
export ERRORNOTIFIER_SERVICE_NAME="billing-worker"
export ERRORNOTIFIER_RELEASE="billing-2026.06.09.1"

2. Capture exceptions and messages

import errornotifier

try:
    raise RuntimeError("Worker job failed")
except RuntimeError as exc:
    errornotifier.capture_exception(
        exc,
        tags={"queue": "billing"},
        request={"url": "/jobs/billing/reconcile"},
    )

errornotifier.capture_message(
    "Nightly billing job finished with retries",
    severity="warning",
    tags={"queue": "billing"},
)

3. Attach Python logging

import logging
from errornotifier import ErrorNotifierLoggingHandler

logger = logging.getLogger("billing-worker")
logger.setLevel(logging.INFO)
logger.addHandler(ErrorNotifierLoggingHandler(level=logging.ERROR))

try:
    1 / 0
except ZeroDivisionError:
    logger.exception("billing reconciliation failed")

4. Flask application sample

from flask import Flask, got_request_exception, request
import errornotifier

app = Flask(__name__)

def report_error(sender, exception, **extra):
    errornotifier.capture_exception(
        exception,
        request={
            "url": getattr(request, "url", ""),
            "method": getattr(request, "method", ""),
        },
        tags={"framework": "flask"},
    )

got_request_exception.connect(report_error, app)

5. Raw requests.post fallback

import os
import requests

# Raw HTTPS fallback using the same ingest contract.
response = requests.post(
    "https://errornotifier.com/wp-json/errornotifier/v1/store",
    headers={
        "X-ErrorNotifier-Key": os.environ["ERRORNOTIFIER_PROJECT_KEY"],
        "Content-Type": "application/json",
    },
    json={
        "platform": "python",
        "severity": "error",
        "message": "Worker job failed",
        "release": os.getenv("ERRORNOTIFIER_RELEASE", ""),
        "environment": os.getenv("ERRORNOTIFIER_ENVIRONMENT", "production"),
        "tags": {"service": "worker"},
    },
    timeout=5,
)
response.raise_for_status()
VariableRequired forNotes
ERRORNOTIFIER_PROJECT_KEYPython error-event ingestionPublic project key sent as X-ErrorNotifier-Key. This is the normal key for Python site errors.
ERRORNOTIFIER_SERVER_KEYProtected backend automationServer secret sent as Authorization: Bearer for releases, deploys, artifacts, and CI records.
ERRORNOTIFIER_ENDPOINTCustom ingest endpointOverrides the default hosted /wp-json/errornotifier/v1/store endpoint.
ERRORNOTIFIER_BASE_URLSelf-hosted ErrorNotifier receiverBuilds /wp-json/errornotifier/v1/store from a base URL when ERRORNOTIFIER_ENDPOINT is absent.
ERRORNOTIFIER_ENVIRONMENTEnvironment taggingDefaults to production.
ERRORNOTIFIER_RELEASERelease correlationAttach build or release version to the event.
ERRORNOTIFIER_SERVICE_NAMEService taggingAdds a stable service tag to events from this Python site.

Cross-language setup

Use the same variable names for Python workers and .NET services when they report to the same ErrorNotifier project. The Python examples and the ErrorNotifier.Extensions.Logging package both understand ERRORNOTIFIER_PROJECT_KEY, ERRORNOTIFIER_SERVER_KEY, ERRORNOTIFIER_ENDPOINT, ERRORNOTIFIER_BASE_URL, ERRORNOTIFIER_ENVIRONMENT, ERRORNOTIFIER_RELEASE, and ERRORNOTIFIER_SERVICE_NAME.

.NET package guide

The .NET guide explains the same key model, including enpk_ project keys as X-ErrorNotifier-Key and server secrets as Authorization: Bearer.

Open .NET logging guide

NuGet package

The package README carries these Python parity examples so .NET developers see the same deployment vocabulary directly in NuGet clients.

Open NuGet package page

Public demo

Review the real product screens with read-only mock data

Open the demo workspace to inspect monitors, incidents, domains, alert channels, status pages, projects, issues, automated test runs, releases, artifacts, audit history, and umbrella reports without creating an account.