Skip to main content

SOPHON Encoding API

Project description

sophon-sdk

Official Python SDK for the SOPHON Encoding API.

This repository is generated from Liqhtworks/sophon-api. The curated README.md and examples/ directory are preserved across SDK regeneration.

Install

pip install sophon-sdk

Requires Python 3.9+.

Quick Start

import os
from pathlib import Path

import sophon_sdk

configuration = sophon_sdk.Configuration(
    host=os.getenv("SOPHON_BASE_URL", "https://api.liqhtworks.xyz"),
    access_token=os.environ["SOPHON_API_KEY"],
)

with sophon_sdk.ApiClient(configuration) as api_client:
    uploads = sophon_sdk.UploadsApi(api_client)

    result = sophon_sdk.upload_file(
        uploads,
        Path("source.mov"),
        file_name="source.mov",
        mime_type="video/quicktime",
        concurrency=4,
    )

    print(result.upload_id)

Upload Input Forms

upload_file accepts all common server-side input forms:

from io import BytesIO
from pathlib import Path

# 1. Path-like input.
sophon_sdk.upload_file(
    uploads,
    Path("source.mov"),
    file_name="source.mov",
    mime_type="video/quicktime",
)

# 2. Bytes input.
data = Path("source.mov").read_bytes()
sophon_sdk.upload_file(
    uploads,
    data,
    file_name="source.mov",
    mime_type="video/quicktime",
)

# 3. Binary file-like input. The object must support seek().
with open("source.mov", "rb") as fh:
    sophon_sdk.upload_file(
        uploads,
        fh,
        file_name="source.mov",
        mime_type="video/quicktime",
    )

# BytesIO works too.
buf = BytesIO(data)
sophon_sdk.upload_file(
    uploads,
    buf,
    file_name="source.mov",
    mime_type="video/quicktime",
)

Webhooks

Use verify_webhook_signature with the raw request body before JSON parsing.

See examples/webhook-server for a FastAPI route that reads the raw body, verifies X-Turbo-Signature-256, and only then parses JSON.

Helpers

Helper Purpose
upload_file Chunked upload orchestration with bounded concurrency, retries, resume, and progress callbacks.
wait_for_job Poll until terminal status with timeout and typed errors.
verify_webhook_signature Constant-time HMAC verification plus replay-window enforcement.

API Docs

Generated endpoint/model docs live under docs/.

License

Proprietary. See LICENSE.

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

sophon_sdk-0.1.4.tar.gz (74.9 kB view details)

Uploaded Source

Built Distribution

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

sophon_sdk-0.1.4-py3-none-any.whl (182.3 kB view details)

Uploaded Python 3

File details

Details for the file sophon_sdk-0.1.4.tar.gz.

File metadata

  • Download URL: sophon_sdk-0.1.4.tar.gz
  • Upload date:
  • Size: 74.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sophon_sdk-0.1.4.tar.gz
Algorithm Hash digest
SHA256 425abd19d6a3f67f450478fbc8ae69c35ccabe91772842de0a4ca39d90ddd62c
MD5 abd9893d6d8fa3f6200bdd37da792fc1
BLAKE2b-256 dfc0cdb72d4fd631c5b4e40fac410c98a669aa12e3a0a9e47708291de06dac1e

See more details on using hashes here.

Provenance

The following attestation bundles were made for sophon_sdk-0.1.4.tar.gz:

Publisher: publish.yml on Liqhtworks/sophon-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sophon_sdk-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: sophon_sdk-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 182.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for sophon_sdk-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 518ec18fd12915587829569a64a594ad787e798ad69f611a3b97adfe0ea1ac16
MD5 c091ac4023f3dc0a9ba22ef4cd2d5ca6
BLAKE2b-256 b2d10002eddef606a6dcc6c358a274fea36b0ad776d5a739fb7bf13d38a365bb

See more details on using hashes here.

Provenance

The following attestation bundles were made for sophon_sdk-0.1.4-py3-none-any.whl:

Publisher: publish.yml on Liqhtworks/sophon-sdk-python

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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