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

Appearance settings

Commit b924541

Browse filesBrowse files
author
Alex Schworer
committed
Update README to reflect node library
1 parent f91a402 commit b924541
Copy full SHA for b924541

File tree

1 file changed

+73
-127
lines changed
Filter options

1 file changed

+73
-127
lines changed

‎README.md

Copy file name to clipboard
+73-127Lines changed: 73 additions & 127 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,35 @@
1-
# Zencoder
2-
[![Build Status](https://travis-ci.org/zencoder/zencoder-py.png?branch=master)](https://travis-ci.org/zencoder/zencoder-py)
3-
4-
A Python module for the [Zencoder](http://zencoder.com) API.
5-
6-
## Installation
7-
Install from PyPI using `easy_install` or `pip`.
8-
9-
pip install zencoder
10-
11-
## Dependencies
12-
`zencoder-py` depends on [requests](http://python-requests.org), and uses the `json` or `simplejson` module.
1+
Zencoder
2+
----
133

14-
## Usage
4+
[![Build Status](https://travis-ci.org/zencoder/zencoder-py.png?branch=master)](https://travis-ci.org/zencoder/zencoder-py)
155

16-
from zencoder import Zencoder
17-
zen = Zencoder('abc123') # enter your api key
6+
A Python module for interacting with the [Zencoder](http://zencoder.com) API.
187

19-
# creates an encoding job with the defaults
20-
job = zen.job.create('http://input-file/movie.avi')
21-
print job.code
22-
print job.body
23-
print job.body['id']
8+
### Getting Started
249

25-
# get the transcode progress of the first output
26-
progress = zen.output.progress(job.body['outputs'][0]['id'])
27-
print progress.body
10+
Install from PyPI
2811

12+
$ pip install zencoder
2913

30-
# configure your outputs with dictionaries
31-
iphone = {
32-
'label': 'iPhone',
33-
'url': 's3://output-bucket/output-file-1.mp4',
34-
'width': 480,
35-
'height': 320
36-
}
37-
web = {
38-
'label': 'web',
39-
'url': 's3://output-bucket/output-file.vp8',
40-
'video_codec':, 'vp8'
41-
}
42-
# the outputs kwarg requires an iterable
43-
outputs = (iphone, web)
44-
another_job = zen.job.create(input_url, outputs=outputs)
14+
Import zencoder
4515

46-
**Note:** If you set the `ZENCODER_API_KEY` environment variable to your api key, you don't have to provide it when initializing Zencoder.
16+
```python
17+
from zencoder import Zencoder
18+
```
4719

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`):
20+
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'.
5021

51-
```python
52-
# set to version 1: https://app.zencoder.com/api/v1/
53-
zen = Zencoder(api_version='v1')
22+
# If you want to specify an API key when creating a client
23+
client = Zencoder('API_KEY')
5424

55-
# set to the edge version: https://app.zencoder.com/api/
56-
zen = Zencoder(api_version='edge')
57-
```
25+
# If you have the environment variable set
26+
client = Zencoder()
5827

59-
## Jobs
28+
## [Jobs](https://app.zencoder.com/docs/api/jobs)
6029

6130
There's more you can do on jobs than anything else in the API. The following methods are available: `list`, `create`, `details`, `progress`, `resubmit`, `cancel`, `delete`.
6231

63-
### create
32+
Create a [new job](https://app.zencoder.com/docs/api/jobs/create).
6433

6534
```python
6635
zen.job.create('s3://bucket/key.mp4')
@@ -77,7 +46,7 @@ response.code # 201
7746
response.body['id'] # 12345
7847
```
7948

80-
### list
49+
[List jobs](https://app.zencoder.com/docs/api/jobs/list).
8150

8251
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`.
8352

@@ -86,31 +55,31 @@ zen.job.list(per_page=10)
8655
zen.job.list(per_page=10, page=2)
8756
```
8857

89-
### details
58+
Get [details](https://app.zencoder.com/docs/api/jobs/show) about a job.
9059

9160
The number passed to `details` is the ID of a Zencoder job.
9261

9362
```python
9463
zen.job.details(1)
9564
```
9665

97-
### progress
66+
Get [progress](https://app.zencoder.com/docs/api/jobs/progress) on a job.
9867

9968
The number passed to `progress` is the ID of a Zencoder job.
10069

10170
```python
10271
zen.job.progress(1)
10372
```
10473

105-
### resubmit
74+
[Resubmit](https://app.zencoder.com/docs/api/jobs/resubmit) a job
10675

10776
The number passed to `resubmit` is the ID of a Zencoder job.
10877

10978
```python
11079
zen.job.resubmit(1)
11180
```
11281

113-
### cancel
82+
[Cancel](https://app.zencoder.com/docs/api/jobs/cancel) a job
11483

11584
The number passed to `cancel` is the ID of a Zencoder job.
11685

@@ -126,97 +95,60 @@ The number passed to `delete` is the ID of a Zencoder job.
12695
zen.job.delete(1)
12796
```
12897

129-
## Inputs
98+
## [Inputs](https://app.zencoder.com/docs/api/inputs)
13099

131-
### details
100+
Get [details](https://app.zencoder.com/docs/api/inputs/show) about an input.
132101

133102
The number passed to `details` is the ID of a Zencoder job.
134103

135104
```python
136105
zen.input.details(1)
137106
```
138107

139-
### progress
108+
Get [progress](https://app.zencoder.com/docs/api/inputs/progress) for an input.
140109

141110
The number passed to `progress` is the ID of a Zencoder job.
142111

143112
```python
144113
zen.input.progress(1)
145114
```
146115

147-
## Outputs
116+
## [Outputs](https://app.zencoder.com/docs/api/outputs)
148117

149-
### details
118+
Get [details](https://app.zencoder.com/docs/api/outputs/show) about an output.
150119

151120
The number passed to `details` is the ID of a Zencoder job.
152121

153122
```python
154123
zen.output.details(1)
155124
```
156125

157-
### progress
126+
Get [progress](https://app.zencoder.com/docs/api/outputs/progress) for an output.
158127

159128
The number passed to `progress` is the ID of a Zencoder job.
160129

161130
```python
162131
zen.output.progress(1)
163132
```
164133

165-
## Accounts
134+
## [Reports](https://app.zencoder.com/docs/api/reports)
166135

167-
### create
136+
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.
168137

169-
No API Key is required.
170-
171-
```python
172-
zen.account.create('foo@example.com', tos=1)
173-
zen.account.create('foo@example.com', tos=1,
174-
options={'password': 'abcd1234',
175-
'affiliate_code': 'foo'})
176-
```
177-
178-
### details
179-
180-
```python
181-
zen.account.details()
182-
```
183-
184-
### integration
185-
186-
This will put your account into integration mode (site-wide).
187-
188-
```python
189-
zen.account.integration()
190-
```
191-
192-
### live
193-
194-
This will put your account into live mode (site-wide).
195-
196-
```python
197-
zen.account.live()
198-
```
199-
200-
## Reports
201-
202-
### minutes
203-
204-
This will list the minutes used for your account within a certain, configurable range.
138+
Get [all usage](https://app.zencoder.com/docs/api/reports/all) (Live + VOD).
205139

206140
```python
207141
import datetime
208-
zen.report.minutes()
209-
zen.report.minutes(grouping="foo")
210-
zen.report.minutes(start_date=datetime.date(2011, 10, 30),
211-
end_date=datetime.date(2011, 11, 24))
212-
zen.report.minutes(start_date=datetime.date(2011, 10, 30),
213-
end_date=datetime.date(2011, 11, 24),
214-
grouping="foo")
142+
zen.report.all()
143+
zen.report.all(grouping="foo")
144+
zen.report.all(start_date=datetime.date(2011, 10, 30),
145+
end_date=datetime.date(2011, 11, 24))
146+
zen.report.all(start_date=datetime.date(2011, 10, 30),
147+
end_date=datetime.date(2011, 11, 24),
148+
grouping="foo")
215149
```
216150

217-
### vod
218-
219-
This will list the VOD minutes used for your account.
151+
Get [VOD usage](https://app.zencoder.com/docs/api/reports/vod).
220152

221153
```python
222154
import datetime
@@ -229,9 +161,7 @@ zen.report.vod(start_date=datetime.date(2011, 10, 30),
229161
grouping="foo")
230162
```
231163

232-
### live
233-
234-
This will list the Live transcoding minutes used for your account.
164+
Get [Live usage](https://app.zencoder.com/docs/api/reports/live).
235165

236166
```python
237167
import datetime
@@ -244,27 +174,43 @@ zen.report.live(start_date=datetime.date(2011, 10, 30),
244174
grouping="foo")
245175
```
246176

247-
### all
177+
## [Accounts](https://app.zencoder.com/docs/api/accounts)
248178

249-
This will list all of the transcoding minutes used for your account.
179+
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.
180+
181+
No API Key is required.
250182

251183
```python
252-
import datetime
253-
zen.report.all()
254-
zen.report.all(grouping="foo")
255-
zen.report.all(start_date=datetime.date(2011, 10, 30),
256-
end_date=datetime.date(2011, 11, 24))
257-
zen.report.all(start_date=datetime.date(2011, 10, 30),
258-
end_date=datetime.date(2011, 11, 24),
259-
grouping="foo")
184+
zen.account.create('foo@example.com', tos=1)
185+
zen.account.create('foo@example.com', tos=1,
186+
options={'password': 'abcd1234',
187+
'affiliate_code': 'foo'})
188+
```
189+
190+
Get [details](https://app.zencoder.com/docs/api/accounts/show) about the current account.
191+
192+
```python
193+
zen.account.details()
260194
```
261195

262-
## Documentation
263-
Docs are in progress, and hosted at Read the Docs: http://zencoder.rtfd.org
196+
Turn [integration mode](https://app.zencoder.com/docs/api/accounts/integration) on (all jobs are test jobs).
197+
198+
```python
199+
zen.account.integration()
200+
```
201+
202+
Turn off integration mode, which means your account is live (and you'll be billed for jobs).
203+
204+
```python
205+
zen.account.live()
206+
```
207+
## Tests
208+
209+
The tests use the `mock` library to stub in response data from the API. Run tests individually:
210+
211+
$ python test/test_jobs.py
264212

265-
## Contributors
266-
* [Senko Rasic](http://github.com/senko)
267-
* [Josh Kennedy](http://github.com/kennedyj)
268-
* [Issac Kelly](http://github.com/issackelly)
213+
Or use `nose`:
269214

215+
$ nosetests
270216

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.