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://docs.indox.org/) |
INDOX_MEDIA_URL |
Media service URL (default: https://docs.indox.org/) |
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.1.tar.gz
(9.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file indox_client-0.2.1.tar.gz.
File metadata
- Download URL: indox_client-0.2.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
27331a589fc1318efd5a080940eaab91ff86e28b20ace4ff3749a400ec4c3e87
|
|
| MD5 |
90ff84d451232671a37f627383f72c1b
|
|
| BLAKE2b-256 |
ad18615e6f2a914d4cbd7c10de2440356bcbbac2b8f160317a37a4510adfa51c
|
File details
Details for the file indox_client-0.2.1-py3-none-any.whl.
File metadata
- Download URL: indox_client-0.2.1-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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77357085b36cd3d1c117ba6f84d23aa69f314d20a34621da6915afce655e8f8b
|
|
| MD5 |
69cd3fd45886f89d6bb29b91a6c210f8
|
|
| BLAKE2b-256 |
61944ea5505d21aeba558b5f15657d6fc6eead1617ec61ed6097dba48db0561a
|