Metadata-Version: 2.4
Name: booboo-sdk
Version: 0.12.0
Summary: Lightweight error tracking for Python
Author-email: "booboo.dev" <hello@booboo.dev>
License-Expression: MIT
Project-URL: Homepage, https://booboo.dev
Project-URL: Repository, https://github.com/getbooboo/python
Project-URL: Issues, https://github.com/getbooboo/python/issues
Project-URL: Changelog, https://github.com/getbooboo/python/blob/main/CHANGELOG.md
Keywords: error-tracking,monitoring,debugging,exceptions,booboo
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Bug Tracking
Classifier: Topic :: System :: Monitoring
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.20
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == "dev"
Requires-Dist: ruff>=0.4; extra == "dev"
Dynamic: license-file

# booboo-sdk

[![CI](https://github.com/getbooboo/python/actions/workflows/ci.yml/badge.svg)](https://github.com/getbooboo/python/actions/workflows/ci.yml)
[![PyPI version](https://img.shields.io/pypi/v/booboo-sdk.svg)](https://pypi.org/project/booboo-sdk/)
[![Python versions](https://img.shields.io/pypi/pyversions/booboo-sdk.svg)](https://pypi.org/project/booboo-sdk/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)

Official Python SDK for [booboo.dev](https://booboo.dev) error tracking.

## Installation

```bash
pip install booboo-sdk
```

## Quick Start

```python
import booboo

booboo.init("your-dsn-here")
```

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

## Manual Capture

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

Or pass an exception explicitly:

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

## User Context

```python
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

```python
from flask import Flask
import booboo

app = Flask(__name__)
booboo.init("your-dsn-here", 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

```python
from fastapi import FastAPI
import booboo

app = FastAPI()
booboo.init("your-dsn-here", app=app)
```

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

## Configuration

```python
booboo.init(
    dsn="your-dsn-here",
    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` | `https://api.booboo.dev/ingest/` | Ingestion endpoint URL |

## 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
