Metadata-Version: 2.4
Name: audithon
Version: 0.1.0
Summary: Official Python client for the Audithon audit and Quality Gate API.
Author-email: Audithon <hello@audithon.dev>
License: MIT
Project-URL: Homepage, https://audithon.dev
Project-URL: Documentation, https://audithon.dev/docs
Project-URL: Source, https://github.com/cjtore/Audithon
Keywords: audithon,audit,security,quality-gate,ci,ai-generated
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Security
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# audithon (Python SDK)

Official Python client for the [Audithon](https://audithon.dev) audit and Quality Gate API.
Zero dependencies (standard library only), Python 3.9+.

## Install

```bash
pip install audithon
```

While the package is not yet published to PyPI, install it from this folder:

```bash
pip install /path/to/Audithon/sdk/python
```

## Usage

```python
import os
from audithon import AudithonClient, AudithonError

client = AudithonClient(api_key=os.environ["AUDITHON_API_KEY"])

# Encola una auditoría y espera el resultado (hasta 90 s por defecto).
audit = client.create_audit(
    "https://your-app.example.com",
    scope_paths=["/login", "/checkout"],
)
print(audit["scoreBreakdown"]["global"], len(audit["findings"]))

gate = client.evaluate_gate(audit["auditId"], min_score_threshold=75)
if not gate["passed"]:
    raise SystemExit(gate["blockingReasons"])

# Reporte Markdown (Pro) y spec de Playwright (objeto con specContent)
markdown = client.get_report_markdown(audit["auditId"])
spec = client.get_playwright_tests(audit["auditId"])
print(spec["fileName"])
```

Async/polled audits:

```python
queued = client.create_audit(url, wait_seconds=0)
completed = client.wait_for_audit(queued["auditId"], timeout_seconds=180)
```

Error handling:

```python
try:
    client.create_audit("https://your-app.example.com")
except AudithonError as error:
    if error.code == "RATE_LIMITED":
        print(error.status, error.body.get("retryAfterSeconds"))
```

## Notes

- API key creation: **Account Settings → CI/CD → API Keys** (Free plan includes keys).
- `create_audit` declares `authorizationConfirmed=True`: only audit apps you own or are
  explicitly authorized to audit.
- Stored checks (`check_ids`) need a signed-in session; with an API key use inline `checks`.
- The SDK is read-only: it never deploys or mutates your app.

MIT licensed.
