Skip to content
Mux Python SDK
Branch: master
Clone or download
GeneticGenesis Pull in assorted fixes from /data/ branch (#8)
* Fix Asset Master access, fix URL on Direct Uploads, clean up unused files, and bump semver

* Reinstate header.
Latest commit 63b16f0 Mar 13, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
test Pull in assorted fixes from /data/ branch (#8) Mar 13, 2019
.gitignore Initial commit of Python SDK \o/ Jan 16, 2019
LICENSE Initial commit of Python SDK \o/ Jan 16, 2019 Add branding header image (#6) Feb 14, 2019
github-python-sdk.png Add branding header image (#6) Feb 14, 2019
requirements.txt Pull in assorted fixes from /data/ branch (#8) Mar 13, 2019

Mux Python Banner

Mux Python

Official Mux API wrapper for python projects 🐍.

Mux Video is an API-first platform, powered by data and designed by video experts to make beautiful video possible for every development team.

Not familiar with Mux? Check out for more information.


Python 2.7 or 3.4+


Via pip

pip install git+

(you may need to run pip with root permission)

Via source

git checkout
cd mux-python
python install --user

Getting Started


Mux Python is a code generated lightweight wrapper around the Mux REST API and reflects them accurately. This has a few consequences you should watch out for:

  1. For almost all API responses, the object you're looking for will be in the data field on the API response object, as in the example below. This is because we designed our APIs with similar concepts to the JSON:API standard. This means we'll be able to return more metadata from our API calls (such as related entities) without the need to make breaking changes to our APIs. We've decided not to hide that in this library.

  2. We don't use a lot of object orientation. For example API calls that happen on a single asset don't exist in the asset class, but are API calls in the AssetsApi which require an asset ID.


To use the Mux API, you'll need an access token and a secret. Details on obtaining these can be found here in the Mux documentation.

Its up to you to manage your token and secret. In our examples, we read them from MUX_TOKEN_ID and MUX_TOKEN_SECRET in your environment.

Example Usage

Below is a quick example of using mux-python to list the Video assets stored in your Mux account.

Be sure to also checkout the exmples directory:

There's also example usage of every API call (also used for testing):

import os
import mux_python
from import ApiException

# Authentication Setup
configuration = mux_python.Configuration()
configuration.username = os.environ['MUX_TOKEN_ID']
configuration.password = os.environ['MUX_TOKEN_SECRET']

# API Client Initialization
assets_api = mux_python.AssetsApi(mux_python.ApiClient(configuration))

# List Assets
print("Listing Assets: \n")
    list_assets_response = assets_api.list_assets()
    for asset in
        print('Asset ID: ' +
        print('Status: ' + asset.status)
        print('Duration: ' + str(asset.duration) + "\n")
except ApiException as e:
    print("Exception when calling AssetsApi->list_assets: %s\n" % e)

Exceptions & Error Handling

All exceptions inherit from ApiException, you can catch it as in the example above, or you can catch one of the more specific exceptions below. You can check the fields error_type and error_messages in all Exceptions to see what error the Mux API reported.


NotFoundException is thrown when a resource is not found. This is useful when trying to get an entity by its ID, for example get_asset("some-id-here") in the AssetsApi.


UnauthorizedException is thrown when Mux cannot authenticate your request. You should check you have configured your credentials correctly.


ServiceException is thrown when Mux returns a HTTP 5XX Status Code. If you encounter this reproducibly, please get in touch with


Be sure to check out the documentation in the docs directory.


If you run into problems, please raise a GitHub issue, filling in the issue template. We'll take a look as soon as possible.


Please do not submit PRs against this package. It is generated from our OpenAPI definitions - Please open an issue instead!


MIT License. Copyright 2019 Mux, Inc.

You can’t perform that action at this time.