Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Python implementation of the Panda REST interface
branch: master

Merge pull request #4 from roverdotcom/master

Fixed handling of unicode params
latest commit 5ab4fe91bf
@vrok vrok authored
Failed to load latest commit information.
panda Fixed handling of unicode params
.gitignore First attempt at publishing this as an egg
LICENSE Paperwork
README.markdown Updated Readme Bump version to 0.1.6-dev


Panda client, Python

This simple Python library provides a low-level interface to the REST API of Panda, the online video encoding service.


This module has been tested with Python 2.5 and 2.6.

You can install it using easy_install:

easy_install panda

To use the module, import it into your application. Then create an instance using your Panda details:

import panda

panda = panda.Panda(
  # api_port=443, ## enables https

Now you can use this instance to interact with your Panda cloud.


Retrieve a list of all your videos:


Before being able to encode videos, you need to define encoding profiles. You can retrieve a list of profiles you have defined for your account:


Initially though, this list will be empty. Solve this by creating a new profile:'/profiles.json', {
    'title':    'My custom profile',
    'category': 'desktop',
    'extname':  'mp4',
    'width':    320,
    'height':   240,
    'command':  'ffmpeg -i $input_file$ -f mp4 -b 128k $resolution_and_padding$ -y $output_file',

From now on, any video that you upload will be encoded in all available profiles by default. Let's upload a video now:'/videos.json', {
    'source_url': '',

It will take some time to encode, depending on the size of the video and other parameters. While you wait, you can check the status of each encoding (one per profile):


Eventually, the process will end and each profile will have a URL where you can retrieve the result from.

Finally, you may want to clean up after your tests:


Generating signatures

All requests to your Panda cloud are signed using HMAC-SHA256, based on a timestamp and your Panda secret key. This is handled transparently. However, sometimes you will want to generate only this signature, in order to make a request by means other than this library. This is the case when using the JavaScript panda_uploader.

To do this, a method signed_params() is provided:

panda.signed_params('POST', '/videos.json')
# => {'access_key': '8df50af4-074f-11df-b278-1231350015b1',
# 'cloud_id': 'your-cloud-id',
# 'signature': 'LejCdm0O83+jk6/Q5SfGmk14WTO1pB6Sh6Z5eA2w5C0=',
# 'timestamp': '2010-02-26T15:01:46.221513'}

panda.signed_params('GET', '/videos.json', {'some_params': 'some_value'})
# => {'access_key': '8df50af4-074f-11df-b278-1231350015b1',
#  'cloud_id': 'your-cloud-id',
#  'signature': 'uHnGZ+kI9mT3C4vW71Iop9z2N7UKCv38v2l2dvREUIQ=',
#  'some_param': 'some_value',
#  'timestamp': '2010-02-26T15:04:27.039620'}
Something went wrong with that request. Please try again.