Metadata-Version: 2.4
Name: reversal-sdk
Version: 1.0.2
Summary: Official Python SDK for the Reversal Engine API
Project-URL: Homepage, https://github.com/Etytabs/REVERSAL
Project-URL: Repository, https://github.com/Etytabs/REVERSAL
Project-URL: Issues, https://github.com/Etytabs/REVERSAL/issues
Project-URL: Changelog, https://github.com/Etytabs/REVERSAL/releases
License: MIT
Keywords: agent,ai,html,json,llm,mcp,pdf,reversal
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: requests>=2.28
Provides-Extra: dev
Requires-Dist: pydantic>=2; extra == 'dev'
Requires-Dist: pytest>=7; extra == 'dev'
Requires-Dist: responses>=0.25; extra == 'dev'
Description-Content-Type: text/markdown

# Reversal SDK — Python

Client Python officiel pour l'API [Reversal Engine](https://github.com/Etytabs/REVERSAL).

## Installation

```bash
pip install reversal-sdk
```

Ou depuis les sources :

```bash
pip install ./sdk/python
```

## Démarrage rapide

```python
from reversal_sdk import ReversalClient

client = ReversalClient(api_key="sk-rev-...")

# Analyser une URL
result = client.reverse("https://example.com")
print(result["content_type"], result["content"])

# Analyser un fichier local (upload automatique)
result = client.reverse("rapport.pdf")

# Mode asynchrone — soumettre un job
job = client.submit_job("gros-fichier.pdf")
# … attendre le résultat en polling
result = client.wait_for_job(job["job_id"])

# Ou streamer les événements en temps réel
for event in client.stream_job(job["job_id"]):
    print(event["event"], event["data"])

# Uploader un fichier manuellement
info = client.upload("document.pdf")
result = client.reverse(f"file:{info['file_id']}")

# Batch (jusqu'à 10 sources)
results = client.batch(["https://a.com", "https://b.com"])

# Infos compte
me = client.me()
print(me["plan"], me["usage"], "/", me["quota"])
```

## Référence API

| Méthode | Description |
|---|---|
| `reverse(source, *, async_mode, extra)` | Parse une source, retourne le résultat structuré |
| `submit_job(source)` | Équivalent à `reverse(..., async_mode=True)` |
| `wait_for_job(job_id, *, poll_interval, timeout)` | Polling jusqu'à `done` ou `failed` |
| `get_job(job_id)` | Récupère l'état courant d'un job |
| `stream_job(job_id)` | Générateur d'événements SSE |
| `upload(path)` | Upload un fichier local |
| `batch(sources, *, async_mode)` | Parse plusieurs sources en une requête |
| `detect(source)` | Détecte le type sans parser |
| `delete_file(file_id)` | Supprime un fichier uploadé |
| `me()` | Infos compte (plan, usage, quota) |

## Exceptions

```python
from reversal_sdk import (
    ReversalError,   # base
    AuthError,       # 401 / 403
    NotFoundError,   # 404
    RateLimitError,  # 429
    QuotaError,      # 402
    ServerError,     # 5xx
)
```

## Variables d'environnement

| Variable | Description |
|---|---|
| `REVERSAL_API_KEY` | Clé API (alternative à `api_key=`) |
