Skip to main content

Build status Coverage

Transloadit python-sdk

A Python Integration for Transloadit's file uploading and encoding service.

Intro

Transloadit is a service that helps you handle file uploads, resize, crop and watermark your images, make GIFs, transcode your videos, extract thumbnails, generate audio waveforms, and so much more. In short, Transloadit is the Swiss Army Knife for your files.

This is a Python SDK to make it easy to talk to the Transloadit REST API.

Only Python 3.9+ versions are supported.

Install

pip install pytransloadit

Usage

from transloadit import client

tl = client.Transloadit('TRANSLOADIT_KEY', 'TRANSLOADIT_SECRET')
assembly = tl.new_assembly()
assembly.add_file(open('PATH/TO/FILE.jpg', 'rb'))
assembly.add_step('resize', '/image/resize', {'width': 70, 'height': 70})
assembly_response = assembly.create(retries=5, wait=True)

print(assembly_response.data.get('assembly_id'))

# or
print(assembly_response.data['assembly_id'])

Example

For fully working examples, take a look at examples/.

Documentation

See readthedocs for full API documentation.

Contributing

Running tests

You can mirror our GitHub Actions setup locally by running the test matrix inside Docker:

scripts/test-in-docker.sh

This script will:

  • build images for the Python versions we test in CI (3.9–3.13)
  • install Poetry, Node.js 20, and the Transloadit CLI
  • pass credentials from .env (if present) so end-to-end tests can run against real Transloadit accounts

Signature parity tests use npx transloadit smart_sig under the hood, matching the reference implementation used by our other SDKs. Our GitHub Actions workflow also runs the E2E upload against Python 3.12 on every push/PR using a dedicated Transloadit test account (wired through the TRANSLOADIT_KEY and TRANSLOADIT_SECRET secrets).

Pass --python 3.12 (or set PYTHON_VERSIONS) to restrict the matrix, or append a custom command after --, for example scripts/test-in-docker.sh -- pytest -k smartcdn.

To exercise the optional end-to-end upload against a real Transloadit account, provide TRANSLOADIT_KEY and TRANSLOADIT_SECRET (via environment variables or .env) and set PYTHON_SDK_E2E=1:

PYTHON_SDK_E2E=1 scripts/test-in-docker.sh --python 3.12 -- pytest tests/test_e2e_upload.py

The test uploads chameleon.jpg, resizes it, and asserts on the live assembly results.

If you have a global installation of poetry, you can run the tests with:

poetry run pytest --cov=transloadit tests

If you can't use a global installation of poetry, e.g. when using Nix Home Manager, you can create a Python virtual environment and install Poetry there:

python -m venv .venv && source .venv/bin/activate && pip install poetry && poetry install

Then to run the tests:

source .venv/bin/activate && poetry run pytest --cov=transloadit tests

Generate a coverage report with:

poetry run pytest --cov=transloadit --cov-report=html tests

Then view the coverage report locally by opening htmlcov/index.html in your browser.

Contributing

See CONTRIBUTING.md for local development, testing, and release instructions.

Release files for pytransloadit 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytransloadit 1.0.4
File Size Uploaded
pytransloadit-1.0.4.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytransloadit 1.0.4
File Interpreter ABI Platform
pytransloadit-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 21.7 kB

Release files / pytransloadit-1.0.4.tar.gz

Download URL pytransloadit-1.0.4.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e0457acef9513fd83e001d2f98d9eca12935f768659fed9048e72c7b8d1b7f63
BLAKE2b-256 checksum
How to use checksums
e6de8e60217782d203e5b156db7da06c28acab26204240eefc4912b36a659d31
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.5 Darwin/25.3.0

Release files / pytransloadit-1.0.4-py3-none-any.whl

Download URL pytransloadit-1.0.4-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4fcf908ce76a2203b80a2ee71d5a2e880658009c9293d8bad2ca55c826a3bc5e
BLAKE2b-256 checksum
How to use checksums
ebf261412f50da598ffc5d76c7e4342bfcbda925ab73e04a7f80abd96c228a19
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/2.4.1 CPython/3.14.5 Darwin/25.3.0

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.12

2 release files

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.1

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page