You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A Python module for the [Zencoder](http://zencoder.com) API.
7
+
A Python module for interacting with the [Zencoder](http://zencoder.com) API.
8
+
9
+
### Getting Started
10
+
11
+
Install from PyPI
12
+
13
+
$ pip install zencoder
14
+
15
+
Import zencoder
16
+
17
+
```python
18
+
from zencoder import Zencoder
19
+
```
20
+
21
+
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 a `ZENCODER_API_KEY` environment variable. API version defaults to 'v2'.
22
+
23
+
# If you want to specify an API key when creating a client
24
+
client = Zencoder('API_KEY')
25
+
26
+
# If you have the environment variable set
27
+
client = Zencoder()
28
+
29
+
## [Jobs](https://app.zencoder.com/docs/api/jobs)
30
+
31
+
Create a [new job](https://app.zencoder.com/docs/api/jobs/create).
32
+
33
+
```python
34
+
client.job.create('s3://bucket/key.mp4')
35
+
client.job.create('s3://bucket/key.mp4',
36
+
outputs=[{'label': 'vp8 for the web',
37
+
'url': 's3://bucket/key_output.webm'}])
38
+
```
39
+
40
+
This returns a `zencoder.Response` object. The body includes a Job ID, and one or more Output IDs (one for every output file created).
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` and `per_page`.
51
+
52
+
```python
53
+
client.job.list(per_page=10)
54
+
client.job.list(per_page=10, page=2)
55
+
```
56
+
57
+
Get [details](https://app.zencoder.com/docs/api/jobs/show) about a job.
58
+
59
+
The number passed to `details` is the ID of a Zencoder job.
60
+
61
+
```python
62
+
client.job.details(1)
63
+
```
64
+
65
+
Get [progress](https://app.zencoder.com/docs/api/jobs/progress) on a job.
66
+
67
+
The number passed to `progress` is the ID of a Zencoder job.
68
+
69
+
```python
70
+
client.job.progress(1)
71
+
```
72
+
73
+
[Resubmit](https://app.zencoder.com/docs/api/jobs/resubmit) a job
74
+
75
+
The number passed to `resubmit` is the ID of a Zencoder job.
76
+
77
+
```python
78
+
client.job.resubmit(1)
79
+
```
80
+
81
+
[Cancel](https://app.zencoder.com/docs/api/jobs/cancel) a job
82
+
83
+
The number passed to `cancel` is the ID of a Zencoder job.
**Note:** If you set the `ZENCODER_API_KEY` environment variable to your api key, you don't have to provide it when initializing Zencoder.
126
+
Reports are great for getting usage data for your account. All default to 30 days from yesterday with no [grouping](https://app.zencoder.com/docs/api/encoding/job/grouping), but this can be altered. These will return `422 Unprocessable Entity` if the date format is incorrect or the range is greater than 2 months.
47
127
48
-
## Specifying the API Version
49
-
Set the version of the Zencoder API you want to use as the `api_version` keyword to the `Zencoder` object (defaults to `v2`):
128
+
Get [all usage](https://app.zencoder.com/docs/api/reports/all) (Live + VOD).
50
129
51
130
```python
52
-
# set to version 1: https://app.zencoder.com/api/v1/
Create a [new account](https://app.zencoder.com/docs/api/accounts/create). 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.
0 commit comments