Skip to navigation

FastPix Python SDK

Learn how the FastPix Python SDK enables video uploads, live streaming, and playback management in Python applications.

The FastPix Python SDK is a type-safe Python client for the FastPix video API. From any Python application you can upload and manage videos, run live streams and simulcasts, create and secure playback IDs, manage playlists and signing keys, pull video analytics, and use in-video AI features. It ships both synchronous and asynchronous clients.


Find more in the SDK reference

For all methods, runnable examples, and advanced usage, see the FastPix Python SDK on GitHub.


Before you begin

Make sure you have:

  • Python 3.9.2 or later
  • A package manager: pip, uv, or Poetry
  • Internet access
  • A FastPix account
  • A FastPix Access Token and Secret Key, generated from the FastPix Dashboard. See Activate your account.

FastPix uses HTTP Basic Authentication. The SDK maps your credentials as follows:

SDK valueFastPix credential
usernameAccess Token
passwordSecret Key

Security: Never commit your Access Token or Secret Key to source control. Use environment variables or a secure credential-management system.

Follow the steps below in order, and do not skip the verification steps. If installation, import, authentication, client initialization, or the first API request fails, fix that problem before continuing.


Check your Python version

python3 --version

The output is similar to Python 3.9.2 or a later version. The SDK supports Python 3.9.2 and later. If your version is earlier than 3.9.2, install a supported version before continuing.


Create a Python project

Create a directory for your application, then create and activate a virtual environment so the SDK installs in an isolated environment:

mkdir fastpix-python-demo
cd fastpix-python-demo
python3 -m venv .venv

Activate the virtual environment:

# macOS and Linux
source .venv/bin/activate
# Windows PowerShell
.venv\Scripts\activate

Confirm the virtual environment is active:

python --version

Install the FastPix SDK

The FastPix Python SDK is distributed as the fastpix-python package. Install it with your package manager:

# pip
pip install fastpix-python
# uv
uv add fastpix-python
# Poetry
poetry add fastpix-python

Verify the SDK installation

Confirm that Python can import the SDK:

python -c "import fastpix_python; print('FastPix SDK installed successfully')"

The expected output is FastPix SDK installed successfully. You can also inspect the installed package:

pip show fastpix-python

If the import fails, confirm that the virtual environment is active, fastpix-python is installed, the Python interpreter belongs to the expected virtual environment, and your Python version is supported.


Configure authentication

FastPix uses HTTP Basic Authentication, where username is your Access Token and password is your Secret Key. For local development, set these as environment variables so they stay out of your source code:

# macOS and Linux
export FASTPIX_USERNAME="<YOUR_ACCESS_TOKEN>"
export FASTPIX_PASSWORD="<YOUR_SECRET_KEY>"
# Windows PowerShell
$env:FASTPIX_USERNAME="<YOUR_ACCESS_TOKEN>"
$env:FASTPIX_PASSWORD="<YOUR_SECRET_KEY>"

Verify that your credentials are set

Check that both variables are set without printing their values:

python -c "import os; print('Access Token:', 'set' if os.getenv('FASTPIX_USERNAME') else 'missing'); print('Secret Key:', 'set' if os.getenv('FASTPIX_PASSWORD') else 'missing')"

Both should report set. If either is missing, set the corresponding environment variable before continuing.


Initialize the FastPix client

Create a file named example.py:

import os
from fastpix_python import Fastpix, models
fastpix = Fastpix(
security=models.Security(
username=os.getenv("FASTPIX_USERNAME"),
password=os.getenv("FASTPIX_PASSWORD"),
),
)
print("FastPix client initialized")

Run it:

python example.py

The expected output is FastPix client initialized. Initializing the client does not make an API request; a request happens only when you call an SDK operation such as fastpix.input_video.create_media(...).


Make your first API request

The easiest way to verify the integration is to create media from a publicly accessible video URL. FastPix provides a sample video at https://static.fastpix.com/fp-sample-video.mp4.

Replace the contents of example.py with:

import json
import os
from fastpix_python import Fastpix, models
with Fastpix(
security=models.Security(
username=os.getenv("FASTPIX_USERNAME"),
password=os.getenv("FASTPIX_PASSWORD"),
),
) as fastpix:
response = fastpix.input_video.create_media(
inputs=[
{
"type": "video",
"url": "https://static.fastpix.com/fp-sample-video.mp4",
},
],
access_policy="public",
metadata={
"source": "fastpix-python-demo",
},
)
print(
json.dumps(
response.model_dump(
mode="json",
by_alias=True,
exclude_unset=True,
),
indent=2,
)
)

Run it:

python example.py

A successful request returns information about the newly created media asset, similar to:

{
"success": true,
"data": {
"id": "..."
}
}

The exact fields depend on the API response and the installed SDK version.


Capture the media ID

The create-media response contains the unique ID assigned to the media asset, at data.id:

{
"success": true,
"data": {
"id": "12345678-1234-1234-1234-123456789abc"
}
}

Save this value for later operations:

MEDIA_ID=<value returned in data.id>

A media_id is not the same as a playback_id. They identify different resources and are used for different operations.


Verify the integration

A successful create-media request confirms that Python is installed and supported, the SDK is installed and importable, your credentials are configured, the client can authenticate, and FastPix returns a media ID.

FastPix Python SDK workflow: a Python application authenticates to the FastPix API over HTTP Basic Auth, creates a media asset, and receives a media ID (data.id), then checks status until the media is ready and creates a playback ID to play the video.

Creating media is usually the first step in a FastPix on-demand workflow: you create the media, poll it until processing finishes, then create a playback ID to play it. The initial SDK integration is now complete.


Resources, error handling, and reference

The SDK is generated from the FastPix API specification, so the complete and always-current reference lives in the repo and the API docs:

  • All resources, operations, error handling, retries, server selection, custom HTTP clients, async usage, and debugging: the FastPix Python SDK on GitHub, with runnable code in the examples directory.
  • Media (upload, manage, playback, playlists, signing keys, DRM): Video on Demand API.
  • Live (streams, simulcasts, live playback): Live Stream API.
  • Video Data (metrics, views, dimensions, errors): Video Data API.
  • In-video AI (summaries, chapters, named entities, moderation): In-Video AI.

Frequently asked questions

What is the difference between the FastPix Python SDK and the REST API?

The SDK is a type-safe Python wrapper around the same FastPix REST API. It handles authentication, request serialization, and response parsing for you, so you call methods like fastpix.input_video.create_media(...) instead of building raw HTTP requests. Anything the SDK does, you can also do by calling the REST API directly. See Make your first API request.

How do I install the FastPix Python SDK?

Run pip install fastpix-python, or uv add fastpix-python / poetry add fastpix-python if you use those package managers. See Install the FastPix SDK.

How do I authenticate the SDK?

FastPix uses HTTP Basic Authentication. Pass your Access Token as the username and your Secret Key as the password in models.Security when constructing the client. See Initialize the FastPix client.

How do I upload a video in Python?

Create media from a URL or a direct upload through the input-video resource on the client, for example fastpix.input_video.create_media(...). See Make your first API request.

What is the maximum video file size I can upload with Python?

FastPix uploads are not limited by your Python process memory. When you pull from a URL, FastPix fetches the file directly, and when you upload from a device, the SDK gives you a signed URL that the file goes to directly, so the bytes never pass through your Python application. Large multi-gigabyte files upload without extra configuration. See the Video on Demand API.

Does the SDK support async?

Yes. The SDK provides both synchronous and asynchronous clients. See the SDK reference on GitHub.

How do I start a live stream?

Use the Live API resources to create and manage streams, simulcasts, and live playback IDs. See the SDK reference on GitHub and the Live Stream API.

How do I create a secure playback ID?

Generate playback IDs and manage signing keys and DRM configurations through the Media API resources. See the SDK reference on GitHub and the Video on Demand API.

How do I keep a video private or stop it from being downloaded?

Create the media with a private access policy, then generate a signed playback ID so only holders of a valid token can play it. For stronger protection, enable DRM on the playback ID. You revoke access by deleting the playback ID. Handle all of this through the Media API resources. See the Video on Demand API.

How do I get video analytics and metrics in Python?

The Video Data API exposes metrics, views, dimensions, and errors for quality-of-experience monitoring. See the Video Data API.

How do I handle API errors?

Wrap calls in try/except and catch errors.FastpixError, which exposes the message, status code, headers, and body. See the SDK reference on GitHub for the error types each operation can throw.

How do I configure automatic retries?

Pass a RetryConfig per call or at client initialization to control the backoff strategy. See the SDK reference on GitHub.

How do I use a custom HTTP client, proxy, or timeout?

Pass your own httpx client (sync or async) when constructing the SDK to configure timeouts, proxies, and custom headers. See the SDK reference on GitHub.

Which Python versions are supported?

Python 3.9.2 and later. See Before you begin.


What’s next

Want to go further? Browse runnable, end-to-end samples for the FastPix Python SDK in the examples folder of the GitHub repository.


Release notes

For a complete history of releases, improvements, and fixes, see the FastPix Python SDK CHANGELOG on GitHub.