Registry / http-networking / mux-python

mux-python

JSON →
library5.1.2pypypi✓ verified 21d ago

Official Mux API wrapper for Python projects, supporting both Mux Data and Mux Video. Mux Video is an API-first platform for building video experiences, while Mux Data provides quality of service analytics. The library is currently at version 5.1.2 and is actively maintained with frequent patch and minor releases.

pip install mux-python
INSTALL
IMPORT
SIG · MUX-PYTHON
M
mux-python
http-networkingpythonv5.1.2
Install
2.1s avg
Import
482ms
Disk
23MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v5.1.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.512s · 24.4MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.1s · import 0.452s · 25MB
23MB installed
● package 23MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Configuration
import mux_python configuration = mux_python.Configuration()
Configuration object is directly within the top-level `mux_python` module.
ApiClient
client = mux_python.ApiClient(configuration)
ApiClient is instantiated from the top-level `mux_python` module.
ApiException
from mux_python.rest import ApiException
Common exceptions like `ApiException` are found in the `mux_python.rest` submodule.
AssetsApi
assets_api = mux_python.AssetsApi(client)
API client classes like `AssetsApi` are available directly from the top-level `mux_python` module and require an `ApiClient` instance.

This quickstart demonstrates how to initialize the Mux Python client using API credentials from environment variables and then list all existing video assets in your Mux account. Mux API responses typically return the primary data object within a `.data` attribute.

import os import mux_python from mux_python.rest import ApiException # Authentication Setup configuration = mux_python.Configuration() configuration.username = os.environ.get('MUX_TOKEN_ID', '') configuration.password = os.environ.get('MUX_TOKEN_SECRET', '') if not configuration.username or not configuration.password: print("Error: MUX_TOKEN_ID and MUX_TOKEN_SECRET environment variables must be set.") exit(1) # API Client Initialization api_client = mux_python.ApiClient(configuration) assets_api = mux_python.AssetsApi(api_client) try: # List Assets print("Listing Mux Assets:") list_assets_response = assets_api.list_assets() if list_assets_response.data: for asset in list_assets_response.data: print(f" Asset ID: {asset.id}, Status: {asset.status}, Duration: {asset.duration}") else: print(" No assets found.") except ApiException as e: print(f"Exception when calling AssetsApi->list_assets: {e}\n") except Exception as e: print(f"An unexpected error occurred: {e}")
Debug
Known issues
breakingIn version 5.0.0, `CreateAssetRequest` changed `input` to `inputs` and `playback_policy` to `playback_policies`. While deprecation notices were added for the old fields, direct usage should update to the new array-accepting fields.
fix
Update `CreateAssetRequest` to use `inputs` and `playback_policies` (which accept lists) instead of the singular `input` and `playback_policy` parameters.
affects: >=5.0.0
deprecatedThe `encoding_tier` parameter has been deprecated since version 3.18.0 and replaced by `video_quality` (e.g., 'standard' or 'premium').
fix
Replace usage of `encoding_tier` with `video_quality` in API calls and model definitions.
affects: >=3.18.0
gotchaMux Python SDK, being code-generated, wraps API responses in an object where the main data payload is often accessed via a `.data` attribute (e.g., `response.data`). Forgetting `.data` will result in accessing the wrapper object instead of the actual API resource.
fix
Always access the `.data` attribute on API response objects to retrieve the expected resource (e.g., `list_assets_response.data`).
affects: All versions
gotchaThe Mux Python SDK is not designed for parsing or modeling webhook payloads directly. Attempting to use SDK models for webhook events may lead to unexpected behavior or errors.
fix
For handling webhooks, it's recommended to parse the incoming JSON payload manually or use a dedicated webhook parsing library, and then extract relevant information rather than relying on SDK models.
affects: All versions
Errors
Common errors & fixes
mux_python.rest.ApiException: (401) Reason: Unauthorized
The Mux API token ID or secret key provided are incorrect or invalid for the requested operation. This often manifests as a `mux_python.rest.ApiException` with an HTTP status code of 401.
fix
Ensure that `configuration.username` (Mux Token ID) and `configuration.password` (Mux Token Secret) are set correctly, typically via environment variables (`os.environ['MUX_TOKEN_ID']` and `os.environ['MUX_TOKEN_SECRET']`).
ModuleNotFoundError: No module named 'mux_python'
The `mux-python` library is not installed in the current Python environment, or the environment where the script is being run does not have access to the installed library.
fix
Install the library using pip: `pip install mux-python` or `pip3 install mux-python` if you have multiple Python versions.
AttributeError: 'ResponseObject' object has no attribute 'expected_attribute'
You are trying to access an attribute or method on a `mux-python` object (e.g., an API response) that does not exist or has a different name than expected. Often, the core data in Mux API responses is nested under a `.data` attribute.
fix
Consult the `mux-python` documentation for the specific API response object to identify the correct attribute names. Frequently, the desired data will be found within the `.data` attribute of the response object (e.g., `response_object.data.id` instead of `response_object.id`).
KeyError: 'some_key'
Attempting to access a non-existent key in a dictionary-like object returned by `mux-python` (e.g., when processing API response data or retrieving environment variables for configuration).
fix
Verify that the key exists before attempting to access it. Use `dictionary.get('some_key', default_value)` to provide a default value if the key is missing, or check for key existence with `if 'some_key' in dictionary:` before direct access. Ensure all required environment variables, like `MUX_TOKEN_ID` and `MUX_TOKEN_SECRET`, are properly set.
Upgrade
Version history
5.1.2latest on PyPI · released Jan 8, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
OpenAI (training)
1
Resources
mux-python — pip install mux-python · libregistry