Skip to main content

Python SDK for the Indox media and document conversion services.

Project description

indox-client

Python SDK for the Indox media and document conversion services.

Installation

pip install indox-client

Quick Start

from indox_client import IndoxClient

# Initialize with API key
client = IndoxClient(api_key="your-api-key")

# Or use environment variables
# export INDOX_API_KEY=your-api-key
client = IndoxClient.from_env()

# Convert a document
result = client.docs.convert_file(
    file_path="document.pdf",
    target_formats=["docx", "txt"]
)

# Wait for completion
completed = client.docs.wait_for_completion(result["conversion_id"])

# Download the result
client.docs.download(
    conversion_id=result["conversion_id"],
    output_path="output.docx",
    fmt="docx"
)

Features

  • Document Conversion: Convert between PDF, DOCX, TXT, and more
  • Media Conversion: Convert images and videos between formats
  • Async Support: Long-polling for conversion status
  • Multiple Sources: Upload files, URLs, or S3 keys

Usage

Document Conversion

# From local file
result = client.docs.convert_file(
    file_path="input.pdf",
    target_formats=["docx"]
)

# From URL
result = client.docs.convert_url(
    file_url="https://example.com/document.pdf",
    target_formats=["docx"]
)

# Check supported formats
formats = client.docs.supported_conversions()

Media Conversion

# Convert image
result = client.media.convert_image(
    file_path="image.png",
    target_formats=["webp", "jpg"]
)

# Convert video
result = client.media.convert_video(
    file_path="video.mp4",
    target_formats=["webm"]
)

# Check supported formats
image_formats = client.media.image_formats()
video_formats = client.media.video_formats()

Context Manager

with IndoxClient.from_env() as client:
    result = client.docs.convert_file(
        file_path="document.pdf",
        target_formats=["docx"]
    )

Configuration

Environment Variable Description
INDOX_API_KEY Your API key
INDOX_DOCS_URL Docs service URL (default: https://indox.org/docs)
INDOX_MEDIA_URL Media service URL (default: https://indox.org/media)

Error Handling

from indox_client import IndoxClient, IndoxHTTPError, IndoxClientError

try:
    result = client.docs.convert_file(
        file_path="document.pdf",
        target_formats=["docx"]
    )
except IndoxHTTPError as e:
    print(f"HTTP {e.status_code}: {e}")
    print(f"Request ID: {e.request_id}")
except IndoxClientError as e:
    print(f"Client error: {e}")

License

Proprietary - see LICENSE for details.

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

indox_client-0.2.0.tar.gz (9.4 kB view details)

Uploaded Source

Built Distribution

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

indox_client-0.2.0-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file indox_client-0.2.0.tar.gz.

File metadata

  • Download URL: indox_client-0.2.0.tar.gz
  • Upload date:
  • Size: 9.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for indox_client-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3d520822d2c3632973d7ed9ac83d2212267a82a1e767c023ff40ff55f8fdacef
MD5 af9d42ee6e551e43cf1d7f4950277d53
BLAKE2b-256 d1fcb9b96287b86937b786d8f059c30120bc5fcc89406ae94ebfe1ee70179423

See more details on using hashes here.

File details

Details for the file indox_client-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: indox_client-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for indox_client-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 58ad9634f8ca961d88cac2d0080f0e0edb7b330a4658f73551dd593e1967eaed
MD5 b42f16f4ce15cb38ca3b6cde4fe59f86
BLAKE2b-256 311b2e2c6c87fb2affff399b319a364e59ad8bf64a56ba67e66f79f98280ba49

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