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

Find more in the SDK reference

To explore more examples, API methods, and advanced usage, see the FastPix Python SDK on GitHub.


Prerequisites

Before you start using the FastPix Python SDK, make sure you have the following:

  1. Python 3.9.2 or later: This SDK is compatible with Python 3.9.2 or higher
  2. Package manager: Ensure you have pip, uv, or poetry installed for dependency management
  3. FastPix API credentials: You’ll need an Access Token and a Secret Key (HTTP Basic Auth). You can generate these credentials by following the steps in the authentication guide.
  4. Basic understanding of Python and REST APIs: Familiarity with Python development and API integration concepts.

Installation

Install the SDK using pip:

1pip install fastpix-python

Import the SDK

1from 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.

1import os
2import json
3
4from fastpix_python import Fastpix, models
5
6with Fastpix(
7 security=models.Security(
8 username="your-access-token",
9 password="your-secret-key",
10 ),
11) as fastpix:
12
13 res = fastpix.input_video.create_media(
14 inputs=[
15 {
16 "type": "video",
17 "url": "https://static.fastpix.com/fp-sample-video.mp4",
18 },
19 ],
20 access_policy="public",
21 metadata={
22 "key1": "value1",
23 },
24 )
25
26 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:

1python index.py

NOTE

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