Python SDK

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

Add secure, scalable video to your Python project

The FastPix Python SDK gives you everything you need to manage video from your backend. Upload files from a public URL, attach metadata, and retrieve playback links, all without building encoding pipelines or managing storage. With this SDK, you can:

  • Upload and organize video assets
  • Define access control and metadata
  • Generate HLS playback URLs
  • Streamline video delivery from your Python server

Installation

Install the SDK using pip:

pip install fastpix-python

Import the SDK

from fastpix_python import Fastpix, models

Example

Let's create a file named index.py

This example shows how to upload a video from a public URL with metadata and public access:

NOTE
In the following example, replace your-access-token and your-secret-key with the Access Token ID and Secret Key values from the .env file you downloaded.

import os
import json

from fastpix_python import Fastpix, models

with Fastpix(
    security=models.Security(
        username="your-access-token",
        password="your-secret-key",
    ),
) as fastpix:

    res = fastpix.input_video.create_media(
        inputs=[
            {
                "type": "video",
                "url": "https://static.fastpix.io/fp-sample-video.mp4",
            },
        ],
        access_policy="public",
        metadata={
            "key1": "value1",
        },
    )

    print(json.dumps(res.model_dump(mode="json", by_alias=True), indent=2))

After the video is processed, you can use the media ID to fetch playback info, monitor status, or transform content through the API.


Run the example

To execute the Python script, use the following command. Make sure to replace index.py with your actual file name if it's different:

python index.py

NOTE

Some methods might throw errors when you are on a trial plan.


Full documentation

See the FastPix Python SDK for additional examples, API methods, and advanced usage.