Metadata-Version: 2.4
Name: documentors
Version: 0.1.0
Summary: Python SDK for the DocuMentors document lifecycle management platform
Project-URL: Homepage, https://github.com/Docu-Mentors/developer-sdk
Project-URL: Documentation, https://docs.docu-mentors.com/sdk/python
Project-URL: Repository, https://github.com/Docu-Mentors/developer-sdk
Project-URL: Issues, https://github.com/Docu-Mentors/developer-sdk/issues
Author-email: Docu-Mentors <sdk@docu-mentors.com>
License-Expression: MIT
License-File: LICENSE
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.25.0
Requires-Dist: pydantic<3,>=2.0.0
Provides-Extra: dev
Requires-Dist: pytest<10,>=7.0; extra == 'dev'
Requires-Dist: respx<1,>=0.21; extra == 'dev'
Description-Content-Type: text/markdown

# DocuMentors Python SDK

Official Python SDK for the DocuMentors document lifecycle management API.

## Installation

```bash
pip install documentors
```

Or install from source:

```bash
pip install -e sdk/python/
```

## Quick Start

```python
from documentors import DocumentorsClient

client = DocumentorsClient(
    base_url="https://your-instance.docu-mentors.com",
    api_key="dk_prod_your_key_here",
)

# Upload a document
doc = client.documents.upload("contract.pdf", title="Q2 Contract", classification="CONFIDENTIAL")

# Scan for PII
scan = client.security.detect_pii(doc.id)
for finding in scan.findings:
    print(f"{finding.type}: {finding.masked_value}")

client.close()
```

## Authentication

### API Key (recommended for integrations)

```python
client = DocumentorsClient(base_url="...", api_key="dk_prod_xxx")
```

### JWT (interactive / service-to-service)

```python
client = DocumentorsClient(base_url="...")
client.login(email="user@example.com", password="secret")
```

### Context Manager

```python
with DocumentorsClient(base_url="...", api_key="dk_prod_xxx") as client:
    docs = client.documents.list()
```

## Resource Namespaces

| Namespace | Description |
|---|---|
| `client.documents` | Upload, list, get, delete, versions, download |
| `client.security` | PII detection/redaction, phishing analysis |
| `client.compliance` | Legal holds, eDiscovery, retention policies |
| `client.admin` | Users, API keys, audit logs, devices |

## Error Handling

```python
from documentors import DocumentorsClient, NotFoundError, RateLimitError

try:
    doc = client.documents.get("bad-id")
except NotFoundError:
    print("Document not found")
except RateLimitError as e:
    print(f"Rate limited — retry after {e.retry_after}s")
```

### Exception Hierarchy

- `DocumentorsError` — base
  - `AuthenticationError` — 401
  - `PermissionDeniedError` — 403
  - `NotFoundError` — 404
  - `ValidationError` — 422
  - `ConflictError` — 409
  - `RateLimitError` — 429 (includes `retry_after`)
  - `ServerError` — 500+

## Transport Features

- Automatic retry with exponential backoff on 429/5xx
- `Retry-After` header support
- Configurable timeout and max retries
- Clean error mapping from HTTP status codes

## Examples

See [`examples/`](examples/) for full working scripts:

- **quickstart.py** — Upload + PII scan + redaction
- **bulk_upload.py** — Batch upload with auto-scan
- **pii_scan_pipeline.py** — Full PII audit → CSV report
- **compliance_report.py** — Legal holds + retention summary

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT
