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.


Changelog

All notable changes to this project will be documented in this file.


[1.1.4]

Changed

  • SDK version bump: 1.1.31.1.4. A maintenance release that aligns the SDK’s internal version identifiers and applies behaviour-preserving code-quality cleanup. It contains no functional, API, or behavioural changes and is fully backward compatible with 1.1.3.

    Updated identifiers:

    • __version__ / package version — now reports 1.1.4 (the internal identifiers were previously lagging at 1.0.1; they are now aligned with the package version).
    • User-Agent header — outbound requests now identify as fastpix-sdk/python 1.1.4.

    Maintainability:

    • Internal static-analysis (SonarQube) cleanup across the SDK, samples, and test harness — bundled request-builder parameters, shared response-handling helpers, duplicated string literals extracted into constants, and nested conditionals merged. No public-surface impact.

Compatibility

  • No changes to public types, method signatures, request/response models, default server URLs, hooks, or retry logic.
  • No action required for existing integrations — upgrade the dependency and re-run pip install --upgrade fastpix_python.

[1.1.3]

⚠️ Important — FastPix is migrating from .io to .com

All FastPix-owned hosts, API endpoints, and documentation links are being moved from the .io TLD to .com. The .io hosts continue to serve traffic during the transition window, but they are slated for deprecation soon — please update any hard-coded references in your application as part of your next deploy.

Old (.io)New (.com)
api.fastpix.ioapi.fastpix.com
stream.fastpix.iostream.fastpix.com
images.fastpix.ioimages.fastpix.com
dashboard.fastpix.iodashboard.fastpix.com
www.fastpix.iowww.fastpix.com
docs.fastpix.io/...fastpix.com/docs/...

What this means for users of fastpix_python:

  • If you rely on SDK defaults, no code change is required. The default server_url in this release points at https://api.fastpix.com/v1/, so bumping to 1.1.3 and re-running pip install --upgrade fastpix_python is enough.
  • If you have an explicit server_url override (e.g. Fastpix(server_url="https://api.fastpix.io/v1/")), change it to https://api.fastpix.com/v1/.
  • If your application code references FastPix asset URLs directly — playback URLs (stream.fastpix.io/...), image CDN (images.fastpix.io/...), dashboard deep links, or doc links in your own README — update them to the .com equivalents before the .io hosts are decommissioned.
  • We strongly recommend upgrading every official FastPix SDK in your stack to its latest release as part of the same change — every SDK is being rolled out with the same migration.

Changed

  • All README, USAGE, and per-SDK documentation pages updated end-to-end from dashboard.fastpix.io / docs.fastpix.io/... to dashboard.fastpix.com / fastpix.com/docs/... so every link in the package points at the post-migration host structure.
  • Reference links (Homepage, Dashboard, API Reference, “Detailed Usage”) repointed to fastpix.com.
  • Sample playback URLs in code examples updated from stream.fastpix.io to stream.fastpix.com.

Docs

  • 173 documentation links across 70 markdown files verified reachable after migration; zero fastpix.com/docs/* URLs are broken. The handful of remaining broken links in the link-check report are expired example assets / placeholder thumbnails inside API response snippets, not navigation targets.

[1.1.2]

Fixed

  • Fixed events field in get_video_view_details response returning empty objects — added validation_alias mappings for abbreviated API keys (pt, e, vt, d) to full camelCase names (playerPlayheadTime, eventName, viewerTime, eventDetails)
  • Fixed eventDetails nested object returning raw abbreviated keys — introduced EventDetails model with proper field mappings (hosthostName, txttext, ccode, errerror, ttype, uurl, brbitrate, hheight, fpsfps, cdcodec, wwidth)
  • Fixed fpSDK and fpSDKVersion fields missing from response — added AliasChoices to accept both fpSdk and fpSDK variants from the API
  • Fixed experimentName null value being excluded from serialized output
  • Added missing custom field to Views model to capture user-defined metadata object

Improved

  • Response models for video view details now fully conform to the OpenAPI spec field names

[1.1.1]

Fixed

  • Fixed SDK import paths in _sub_sdk_map - changed from Fastpix.* to fastpix_python.* to resolve ModuleNotFoundError for end users
  • Fixed all documentation examples - removed unnecessary sys.path.append() statements
  • Updated method name from create_from_url to create_media in examples

Improved

  • All SDK documentation examples now work out-of-the-box without workarounds
  • Consistent import statements across all documentation files

[1.1.0]

Fixed

  • Fixed missing parameters in multiple API methods.

Improved

  • Improved overall developer experience through more accurate typings.

[1.0.3]

Fixed

  • Fixed pyproject.toml file Packaging Issue

[1.0.2]

Fixed

  • Fixed Packaging Issue

[1.0.1]

Fixed

  • Fixed all error handling links in README.md documentation
    • Corrected typos in file paths (e.g., fFastpixFastpix)
    • Updated filenames to match actual error class files (added missing underscores)
    • Fixed 23 error class links to properly redirect to correct files
    • Verified all links now point to existing files in src/Fastpix/errors/ directory

[1.0.0]

Added

  • Complete API coverage for Media, Live Streaming, Video Data, and Signing Keys
  • Python 3.9+ support with async/await patterns and type hints
  • Media upload, management, and processing capabilities
  • Live streaming with simulcasting support
  • Video analytics and performance tracking
  • Cryptographic signing keys for secure authentication
  • In-video AI processing features
  • DRM configuration and management
  • Playlist creation and management
  • Comprehensive error handling with specific exception types
  • Both sync and async client implementations
  • Built-in retry mechanisms and timeout handling

Changed

  • Reorganized package structure for better maintainability
  • Updated dependencies to modern Python packages (httpx, pydantic, httpcore)
  • Improved API design with better error handling
  • Enhanced documentation and examples

Fixed

  • Improved error handling with specific exception types
  • Fixed type annotation issues for better IDE support
  • Ensured consistent API patterns across modules

[0.1.8]

Added

  • Enhanced README documentation with comprehensive usage examples
  • Improved project setup and installation instructions

Changed

  • Updated version number to reflect latest improvements
  • Restructured documentation for better user experience
  • Enhanced code examples and API usage guides

[0.1.7]

Added

  • New base URL configuration system for better API connectivity
  • Support for different API environments (production, staging, development)

Changed

  • Updated base URL configuration for improved API endpoint resolution
  • Enhanced connection stability and reliability
  • Improved error handling for connection issues

[0.1.6]

Added

  • Project URL management system for better package distribution
  • Enhanced package metadata and configuration

Changed

  • Updated project URLs in configuration files for better package identification
  • Improved package metadata and distribution information
  • Enhanced project discoverability and documentation links

[0.1.5]

Added

  • Comprehensive version tracking and file management system
  • Automated version control and release management
  • Initial project structure and configuration framework

Changed

  • Updated version number and project configuration
  • Improved project organization and file structure
  • Enhanced build and deployment processes

[0.1.4]

Added

  • New package naming convention for better identification
  • Enhanced package metadata and distribution information

Changed

  • Changed package name for better identification and distribution
  • Updated package metadata and configuration
  • Improved package discoverability and installation process

[0.1.3]

Added

  • Version management improvements
  • Enhanced configuration system

Changed

  • Updated version number to reflect latest changes
  • Improved project configuration and build processes
  • Enhanced package metadata and dependencies

[0.1.2]

Added

  • Comprehensive documentation link validation system
  • Enhanced workflow automation and CI/CD pipeline

Fixed

  • Corrected redirection links in README documentation
  • Fixed broken documentation links for better user experience
  • Resolved navigation issues in project documentation

Changed

  • Updated workflow configuration and processes
  • Improved project automation and deployment pipeline
  • Enhanced documentation structure and organization

[0.1.1]

Changed

  • Updated codebase with consistent naming conventions
  • Added comprehensive package description

Fixed

  • Resolved naming convention inconsistencies

[0.1.0]

Added

  • Initial release of FastPix Python SDK
  • Sync and async client support
  • Media API integration with upload, management, and processing
  • Playback ID management for media files
  • Media operations (list, get, update, delete)
  • Presigned URL generation for video uploads
  • Livestream API integration
  • Livestream management (create, update, delete)
  • Playback ID management for livestreams
  • Simulcast configuration for livestreams