Metadata-Version: 2.4
Name: shieldpress-tracker
Version: 1.0.0
Summary: Monitoring, performance and security SDK for Python applications
Author-email: ShieldPress <hello@shieldpress.net>
License-Expression: MIT
Project-URL: Homepage, https://shieldpress.net
Project-URL: Repository, https://github.com/shieldpress/tracker
Keywords: shieldpress,monitoring,security,apm,django,flask,wsgi
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

<p align="center">
  <a href="https://shieldpress.net/">
    <img src="https://shieldpress.net/logo.png" alt="ShieldPress" width="500">
  </a>
</p>

# shieldpress-tracker for Python

Monitoring, performance and application-security telemetry for Python 3.8+ with no required third-party dependencies.

Dashboard: [https://shieldpress.net/](https://shieldpress.net/)

## Install

```bash
pip install shieldpress-tracker
```

## Quick start

```python
from shieldpress_tracker import ShieldPress

tracker = ShieldPress.init(
    api_key="YOUR_SHIELDPRESS_API_KEY",
    site_id="auto",
    app_name="my-python-app",
)
```

Configuration can also use `SHIELDPRESS_API_KEY`, `SHIELDPRESS_SITE_ID`, `SHIELDPRESS_API_URL`, `SHIELDPRESS_APP_NAME` and `SHIELDPRESS_APP_VERSION` environment variables.

## Flask / WSGI

```python
from flask import Flask
from shieldpress_tracker import ShieldPress

app = Flask(__name__)
tracker = ShieldPress.init(api_key="...", site_id="auto", app_name="flask-app")
app.wsgi_app = tracker.middleware(app.wsgi_app)
```

## Django

Wrap the WSGI application in `wsgi.py`:

```python
from shieldpress_tracker import ShieldPress

application = ShieldPress.instance().middleware(application)
```

## Manual instrumentation

```python
tracker.record_request("/orders", "POST", 201, 42.5)
tracker.capture_error(ValueError("Invalid order"), {"order_id": 123})
tracker.analyze_request("/login", "POST", headers, body, ip="203.0.113.2")
tracker.record_auth_failure(ip="203.0.113.2", url="/login", reason="bad password")
tracker.record_rate_limit(ip="203.0.113.2", url="/api")
tracker.record_cors_violation(ip="203.0.113.2", origin="https://untrusted.example", url="/api")
tracker.flush()
tracker.stop()
```

Options use snake_case: `api_url`, `report_interval`, `system_metrics`, `http_tracking`, `error_tracking`, `security_tracking`, `dep_audit`, `dep_audit_interval`, `runtime_metrics`, `env_security`, `heartbeat`, `app_version`, `environment`, `tags`, `ignore_paths`, `max_error_buffer`, `max_security_buffer`, and `debug`.

The SDK never raises a network/reporting failure into the host application. Reports are sent to `/api/tracker/report` with Bearer authentication.
