Skip to main content

Lightweight error tracking for Python

Project description

booboo-sdk

CI PyPI version Python versions License: MIT

Official Python SDK for booboo.dev error tracking.

Installation

pip install booboo-sdk

Quick Start

import booboo

booboo.init("https://YOUR_TOKEN@ingest.booboo.dev/your-org/your-project")

That's it. Unhandled exceptions are automatically captured and sent to booboo.dev.

The DSN is a URL — the SDK parses out the ingest host so you don't need to configure an endpoint separately. Bare tokens (e.g. "abc123...") are also accepted for back-compat with older dashboards.

Manual Capture

try:
    risky_operation()
except Exception:
    booboo.capture_exception()  # captures the current exception

Or pass an exception explicitly:

try:
    risky_operation()
except Exception as e:
    booboo.capture_exception(e)

User Context

booboo.set_user({
    "id": "123",
    "email": "user@example.com",
    "username": "alice",
})

Framework Integration

Django

Auto-detected — no extra setup needed. The SDK injects middleware and patches Django's internal exception handler to capture errors that never reach middleware (like DisallowedHost). 404 errors are filtered by default.

Flask

from flask import Flask
import booboo

app = Flask(__name__)
booboo.init("https://YOUR_TOKEN@ingest.booboo.dev/your-org/your-project", app=app)

Or without passing app — the SDK monkey-patches Flask.__init__ to auto-register on any Flask app created after init(). 404 errors are filtered by default.

FastAPI

from fastapi import FastAPI
import booboo

app = FastAPI()
booboo.init("https://YOUR_TOKEN@ingest.booboo.dev/your-org/your-project", app=app)

Same auto-detection as Flask if app is not passed explicitly.

Configuration

booboo.init(
    dsn="https://YOUR_TOKEN@ingest.booboo.dev/your-org/your-project",
    environment="production",
    ignore_errors=[KeyboardInterrupt, ConnectionError],
)
Parameter Default Description
dsn (required) Your project's DSN from booboo.dev
app None Flask/FastAPI app instance for explicit registration
environment "" Environment name (e.g. "production", "staging"). Attached to every event.
ignore_errors None List of exception classes to suppress. Uses isinstance() so subclasses are matched.
endpoint derived from DSN URL, or https://ingest.booboo.dev/ Override the ingest endpoint. Normally unnecessary — the SDK derives it from the DSN URL automatically.
before_send None Hook called with the event dict before every send. Return the (possibly modified) event, or None to drop it. If the hook raises, the event is dropped.

before_send Hook

Use before_send to inspect or modify events before they leave your server, or to drop them entirely. The SDK already scrubs sensitive variables by name (password, token, …), but only your code knows which values are sensitive — use before_send for value-level scrubbing such as IBANs, payment references, or emails inside variable values:

import re

IBAN_RE = re.compile(r"\b[A-Z]{2}\d{2}[A-Z0-9]{10,30}\b")

def scrub_ibans(event):
    # Frames live on the top-level stacktrace and on each chained exception
    all_frames = list(event.get("stacktrace", []))
    for exc in event.get("exceptions", []):
        all_frames.extend(exc.get("stacktrace", []))
        exc["value"] = IBAN_RE.sub("[iban]", exc.get("value", ""))
    for frame in all_frames:
        for name, value in frame.get("vars", {}).items():
            frame["vars"][name] = IBAN_RE.sub("[iban]", value)
    event["message"] = IBAN_RE.sub("[iban]", event.get("message", ""))
    return event  # return None instead to drop the event

booboo.init(
    dsn="https://YOUR_TOKEN@ingest.booboo.dev/your-org/your-project",
    before_send=scrub_ibans,
)

The hook receives every event (exceptions and capture_message() calls alike) and runs on the SDK's background sender thread, so it never adds latency to your request path.

Features

  • Automatic capture of unhandled exceptions
  • Rich stack traces with source context and local variables
  • Exception chain support (raise ... from ...)
  • PII scrubbing for sensitive headers and variables
  • Django, Flask, and FastAPI integrations
  • Non-blocking event delivery
  • Graceful shutdown flush
  • Minimal dependency footprint (requests only)

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

booboo_sdk-0.14.0.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

booboo_sdk-0.14.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file booboo_sdk-0.14.0.tar.gz.

File metadata

  • Download URL: booboo_sdk-0.14.0.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for booboo_sdk-0.14.0.tar.gz
Algorithm Hash digest
SHA256 c0df07f4870b21fecad9a2d0398925ccddc7bb7da4f89417f3be69c521215ad2
MD5 08f34e256bcd0eec0588896c769ae343
BLAKE2b-256 2d0e56e6453a733f0e54fe78286409ddb322c49eb1b7d33d79f5244bfd010a6c

See more details on using hashes here.

Provenance

The following attestation bundles were made for booboo_sdk-0.14.0.tar.gz:

Publisher: publish.yml on getbooboo/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file booboo_sdk-0.14.0-py3-none-any.whl.

File metadata

  • Download URL: booboo_sdk-0.14.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for booboo_sdk-0.14.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3ca6cbddeaf8353dfeb767d1273593a4e02ac904abcaef300eb7ecdbf16dda0c
MD5 4d279741992af4c4bab5484a5e8d9ee5
BLAKE2b-256 7eda02ef23aebb1cc3d34becdaea58c07f0703beb9a4cc923e83325f90e6098d

See more details on using hashes here.

Provenance

The following attestation bundles were made for booboo_sdk-0.14.0-py3-none-any.whl:

Publisher: publish.yml on getbooboo/python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page