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 Indox

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

# Or use environment variable (INDOX_API_KEY)
client = Indox()

# Convert a font file (all-in-one)
path = client.fonts.convert_and_download(
    "./font.ttf",
    target_format="woff2",
    output_path="./font.woff2"
)
print(f"Downloaded: {path}")

Features

  • Font Conversion: Convert between TTF, OTF, WOFF, WOFF2, EOT, SVG, and 13+ other formats
  • Media Conversion: Convert images and videos (coming soon)
  • Simple API: OpenAI-style client pattern
  • Multiple Input Sources: Local files, S3 keys

Font Conversion

List Supported Formats

from indox_client import Indox

client = Indox(api_key="your-api-key")

# Get all engines and formats
formats = client.fonts.formats.list()
print(f"Total formats: {formats['total_formats']}")
print(f"Engines: {list(formats['engines'].keys())}")

# Get outputs for specific input format
outputs = client.fonts.formats.get("ttf")
for out in outputs["outputs"]:
    print(f"  ttf -> {out['output']} ({out['engine']})")

Convert Font File

Option 1: All-in-one (recommended)

path = client.fonts.convert_and_download(
    "./font.ttf",
    target_format="woff2",
    output_path="./font.woff2",
    timeout=60.0
)

Option 2: Step-by-step

# Upload
upload = client.fonts.upload("./font.ttf")
print(f"Uploaded: {upload['s3_key']}")

# Convert
job = client.fonts.convert(upload["s3_key"], target_format="woff2")
print(f"Job ID: {job['id']}")

# Wait for completion
result = client.fonts.conversions.wait(job["id"], timeout=60.0)
print(f"Status: {result['status']}")

# Download
path = client.fonts.conversions.download(job["id"], "./font.woff2")
print(f"Downloaded: {path}")

Validate Before Converting

validation = client.fonts.validate("./font.ttf", target_format="woff2")

if validation["valid"]:
    print(f"Engine: {validation['engine']}")
    print(f"Credits: {validation['credits']}")
else:
    print("Conversion not supported")

Context Manager

from indox_client import Indox

with Indox(api_key="your-api-key") as client:
    path = client.fonts.convert_and_download(
        "./font.ttf",
        target_format="woff2",
        output_path="./font.woff2"
    )

Configuration

Environment Variable Description Default
INDOX_API_KEY Your API key Required
INDOX_BASE_URL Base URL https://indox.org
# Custom base URL
client = Indox(
    api_key="your-api-key",
    base_url="http://localhost:4800"
)

Error Handling

from indox_client import (
    Indox,
    IndoxError,
    APIStatusError,
    AuthenticationError,
    PaymentRequiredError,
    NotFoundError,
    RateLimitError,
    ConversionError,
    ConversionTimeoutError,
)

client = Indox(api_key="your-api-key")

try:
    path = client.fonts.convert_and_download(
        "./font.ttf",
        target_format="woff2",
        output_path="./font.woff2"
    )
except AuthenticationError:
    print("Invalid API key")
except PaymentRequiredError:
    print("Insufficient credits")
except NotFoundError:
    print("Endpoint or resource not found")
except RateLimitError:
    print("Too many requests")
except ConversionError as e:
    print(f"Conversion failed: {e.message}")
except ConversionTimeoutError:
    print("Conversion timed out")
except APIStatusError as e:
    print(f"API error {e.status_code}: {e.message}")
except IndoxError as e:
    print(f"Error: {e.message}")

Supported Font Formats

Engine Formats
fonttools ttf, otf, woff, woff2
fontforge ttf, otf, woff, woff2, eot, svg, pfa, pfb, ufo, dfont, ttc, bdf, pt3, t42, cff, sfd, fon, fnt, otb

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.3.tar.gz (12.9 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.3-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for indox_client-0.2.3.tar.gz
Algorithm Hash digest
SHA256 f84bdf4153a08f9eb2c716bbab78b864dab696653bc73b75191f607a3d0de343
MD5 cbf246d3d1e72db1c08fd016a0926202
BLAKE2b-256 412d3463552311773d7d561728522a916bac593f20630d1e0d9c0e9ecb8fda95

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for indox_client-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 71841affdbe067ed2ab0db4d0f6f81eba4b15f3724c52c91dfbd5daed67748b3
MD5 d2162285c8b86f00c834bf47a3a6223e
BLAKE2b-256 e20a1de0939cd87b2b8054c912d61f8accd5f0d1145fc794c3415677e7334691

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