Skip to main content

Python SDK for the DocuMentors document lifecycle management platform

Project description

DocuMentors Python SDK

Official Python SDK for the DocuMentors document lifecycle management API.

Installation

pip install documentors

Or install from source:

pip install -e sdk/python/

Quick Start

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)

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

JWT (interactive / service-to-service)

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

Context Manager

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

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/ 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

pip install -e ".[dev]"
pytest

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

documentors-0.1.0.tar.gz (18.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

documentors-0.1.0-py3-none-any.whl (15.5 kB view details)

Uploaded Python 3

File details

Details for the file documentors-0.1.0.tar.gz.

File metadata

  • Download URL: documentors-0.1.0.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for documentors-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5f7c43179c0233d3d219edb53a929690264e308107420f1c48537c49a9406c88
MD5 70c21b2a97ba0c80ee1e8a2a70a96872
BLAKE2b-256 852b1a7a911bddc7de445093c233b24c4592c6cd0b07e80bd12196aff6807860

See more details on using hashes here.

File details

Details for the file documentors-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: documentors-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for documentors-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a17fb5baec6afe8d55f2b0a6d6626199b83f134aff9a662ed9529755cec016c2
MD5 deaed6d9b94fea69c101e32b5fa9aea5
BLAKE2b-256 f0d337f8724fbf2c516ea75652a2d943e1a22dd36718ec6597bdcd055db5088b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page