Metadata-Version: 2.4
Name: tezzinc
Version: 0.1.0
Summary: Official Python SDK for the Tezzinc video transcoding & subtitling platform.
Author: Tezzinc
License: MIT
Project-URL: Homepage, https://tezzinc.com
Project-URL: Documentation, https://tezzinc.com/#/docs/python
Project-URL: Source, https://tezzinc.com
Keywords: tezzinc,video,transcoding,ffmpeg,subtitles,api,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Video :: Conversion
Classifier: Typing :: Typed
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: httpx>=0.24
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-httpx>=0.30; extra == "dev"
Requires-Dist: ruff>=0.1; extra == "dev"

# tezzinc — Python SDK

The official Python client for the [Tezzinc](https://tezzinc.com) video
transcoding & subtitling platform. A thin, typed wrapper over the same REST
API the console and the MCP server use.

```bash
pip install tezzinc
```

## Quickstart

```python
import os
from tezzinc import Tezzinc, TezzincError

client = Tezzinc(api_key=os.environ["TEZZINC_API_KEY"])   # or just Tezzinc()

# 1. Register a source
asset = client.assets.create(
    source_uri="https://example.com/clip.mp4",
    content_type="video/mp4",
)

# 2. Submit a transcode
job = client.jobs.create(
    asset_id=asset.id,
    spec={"preset_id": "h264_1080p"},
    correlation_id="my-first-job",
)
print("submitted", job.id, "status=", job.status)

# 3. Wait for it (polling; use a webhook on a server)
final = client.jobs.wait_for(job.id, timeout=600, poll_interval=2.0)

# 4. Read the outputs (signed, short-lived URLs)
for out in final.outputs:
    signed = client.outputs.signed_url(out.id, ttl_seconds=900)
    print(out.preset_id, out.byte_size, signed.url)
```

## Configuration

The client reads the API key from, in order: the `api_key=` argument, the
`TEZZINC_API_KEY` environment variable, or `Tezzinc.from_config("config.json")`.
The base URL defaults to `https://tezzinc.com` and can be overridden with
`base_url=` or `TEZZINC_API_BASE`.

## Errors

Every non-2xx response raises `TezzincError` with `.status` (HTTP code),
`.code` (machine-readable, e.g. `"quota_exceeded"`), `.message`, and
`.headers` (read `Retry-After` on a 429). Transport failures raise
`TezzincConnectionError` (a subclass, `status == 0`).

```python
from tezzinc import TezzincError

try:
    client.jobs.create(asset_id=asset.id, spec={"preset_id": "h264_1080p"})
except TezzincError as e:
    if e.status == 429:
        retry_after = int(e.headers.get("Retry-After", "60"))
    elif e.status >= 500:
        ...  # retry with jitter
```

## Resources

| Namespace | Methods |
|-----------|---------|
| `client.assets`  | `create`, `get`, `list`, `delete` |
| `client.jobs`    | `create`, `get`, `list`, `cancel`, `wait_for` |
| `client.presets` | `list` |
| `client.outputs` | `signed_url` |

Responses are attribute-accessible (`job.status`, `job.outputs[0].preset_id`)
and also expose `.raw` for the underlying dict.

MIT licensed.
