Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Zencoder integration library for Python

License

NotificationsYou must be signed in to change notification settings

zencoder/zencoder-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Build Status

A Python module for interacting with theZencoder API.

Getting Started

Install from PyPI

$ pip install zencoder

Import zencoder

fromzencoderimportZencoder

Create an instance of the Zencoder client. This will accept an API key and version. If not API key is set, it will look for aZENCODER_API_KEY environment variable. API version defaults to 'v2'.

# If you want to specify an API key when creating a clientclient=Zencoder('API_KEY')# If you have the environment variable setclient=Zencoder()

Create anew job.

client.job.create('s3://bucket/key.mp4')client.job.create('s3://bucket/key.mp4',outputs=[{'label':'vp8 for the web','url':'s3://bucket/key_output.webm'}])

This returns azencoder.Response object. The body includes a Job ID, and one or more Output IDs (one for every output file created).

response=client.job.create('s3://bucket/key.mp4')response.code# 201response.body['id']# 12345

List jobs.

By default the jobs listing is paginated with 50 jobs per page and sorted by ID in descending order. You can pass two parameters to control the paging:page andper_page.

client.job.list(per_page=10)client.job.list(per_page=10,page=2)

Getdetails about a job.

The number passed todetails is the ID of a Zencoder job.

client.job.details(1)

Getprogress on a job.

The number passed toprogress is the ID of a Zencoder job.

client.job.progress(1)

Resubmit a job

The number passed toresubmit is the ID of a Zencoder job.

client.job.resubmit(1)

Cancel a job

The number passed tocancel is the ID of a Zencoder job.

client.job.cancel(1)

Getdetails about an input.

The number passed todetails is the ID of a Zencoder input.

client.input.details(1)

Getprogress for an input.

The number passed toprogress is the ID of a Zencoder input.

client.input.progress(1)

Getdetails about an output.

The number passed todetails is the ID of a Zencoder output.

client.output.details(1)

Getprogress for an output.

The number passed toprogress is the ID of a Zencoder output.

client.output.progress(1)

Reports are great for getting usage data for your account. All default to 30 days from yesterday with nogrouping, but this can be altered. These will return422 Unprocessable Entity if the date format is incorrect or the range is greater than 2 months.

Getall usage (Live + VOD).

importdatetimeclient.report.all()client.report.all(grouping="foo")client.report.all(start_date=datetime.date(2011,10,30),end_date=datetime.date(2011,11,24))client.report.all(start_date=datetime.date(2011,10,30),end_date=datetime.date(2011,11,24),grouping="foo")

GetVOD usage.

importdatetimeclient.report.vod()client.report.vod(grouping="foo")client.report.vod(start_date=datetime.date(2011,10,30),end_date=datetime.date(2011,11,24))client.report.vod(start_date=datetime.date(2011,10,30),end_date=datetime.date(2011,11,24),grouping="foo")

GetLive usage.

importdatetimeclient.report.live()client.report.live(grouping="foo")client.report.live(start_date=datetime.date(2011,10,30),end_date=datetime.date(2011,11,24))client.report.live(start_date=datetime.date(2011,10,30),end_date=datetime.date(2011,11,24),grouping="foo")

Create anew account. A unique email address and terms of service are required, but you can also specify a password (and confirmation) along with whether or not you want to subscribe to the Zencoder newsletter. New accounts will be created under the Test (Free) plan.

No API Key is required.

client.account.create('foo@example.com',tos=1)client.account.create('foo@example.com',tos=1,options={'password':'abcd1234','password_confirmation':'abcd1234','affiliate_code':'foo'})

Getdetails about the current account.

client.account.details()

Turnintegration mode on (all jobs are test jobs).

client.account.integration()

Turn off integration mode, which means your account is live (and you'll be billed for jobs).

client.account.live()

Tests

The tests use themock library to stub in response data from the API. Run tests individually:

$ python test/test_jobs.py

Or usenose:

$ nosetests

About

Zencoder integration library for Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors9

Languages


[8]ページ先頭

©2009-2025 Movatter.jp