Metadata-Version: 2.4
Name: snare-sdk
Version: 0.0.1
Summary: Snare error-monitoring SDK for Python
Requires-Python: >=3.8
Description-Content-Type: text/markdown

# snare-sdk

Python error-monitoring SDK for [Snare](https://snare.dev). Captures
uncaught exceptions (main thread and background threads) and manual
`except` blocks, batches them, and delivers them to your Snare project.

## Install

```bash
pip install snare-sdk
```

Zero runtime dependencies — pure standard library.

## Usage

```python
import snare

snare.init(project_id="proj_abc123", api_key="snare_sdk_...")

try:
    risky_call()
except Exception:
    snare.capture_exception()
```

Once `snare.init(...)` has run, uncaught exceptions on the main thread and
on any `threading.Thread` are captured automatically — no further setup
required. Call `snare.capture_exception()` with no argument from inside an
`except` block to capture the exception currently being handled, or pass
one explicitly: `snare.capture_exception(some_error)`.

## Behavior

- Events are batched and flushed every 5 events, or 10 seconds after the
  first queued event, whichever comes first.
- Remaining queued events are flushed automatically at process exit.
- Delivery is best-effort: a failed or slow network call never raises into
  your application.
- `snare.init(...)` wraps any pre-existing `sys.excepthook` /
  `threading.excepthook` rather than replacing them, so other tooling
  (debuggers, other error trackers) installed before or after `init()`
  keeps working.

## Development

Run the verify script (this repo's lightweight alternative to a pytest
suite — see `verify_capture.py`):

```bash
python3 verify_capture.py
```

Every line should print `PASS`.
