@@ -167,7 +167,7 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
167
167
Initializes Zencoder. You must have a valid API_KEY.
168
168
169
169
You can pass in the api_key as an argument, or set
170
- ' ZENCODER_API_KEY' as an environment variable, and it will use
170
+ ` ZENCODER_API_KEY` as an environment variable, and it will use
171
171
that, if api_key is unspecified.
172
172
173
173
Set api_version='edge' to get the Zencoder development API. (defaults to 'v2')
@@ -190,9 +190,12 @@ def __init__(self, api_key=None, api_version=None, as_xml=False, timeout=None, t
190
190
191
191
self .test = test
192
192
self .as_xml = as_xml
193
- self .job = Job (self .base_url ,self .api_key ,self .as_xml ,timeout = timeout ,test = self .test )
194
- self .account = Account (self .base_url ,self .api_key ,self .as_xml ,timeout = timeout )
195
- self .output = Output (self .base_url ,self .api_key ,self .as_xml ,timeout = timeout )
193
+
194
+ args = (self .base_url ,self .api_key ,self .as_xml )
195
+ kwargs = dict (timeout = timeout ,test = self .test ,version = api_version )
196
+ self .job = Job (* args ,** kwargs )
197
+ self .account = Account (* args ,** kwargs )
198
+ self .output = Output (* args ,** kwargs )
196
199
197
200
class Response (object ):
198
201
"""
@@ -207,11 +210,12 @@ def __init__(self, code, body, raw_body, raw_response):
207
210
208
211
class Account (HTTPBackend ):
209
212
""" Account object """
210
- def __init__ (self ,base_url , api_key = None , as_xml = False , timeout = None ):
213
+ def __init__ (self ,* args , ** kwargs ):
211
214
"""
212
215
Initializes an Account object
213
216
"""
214
- super (Account ,self ).__init__ (base_url ,api_key ,as_xml ,'account' ,timeout = timeout )
217
+ kwargs ['resource_name' ]= 'account'
218
+ super (Account ,self ).__init__ (* args ,** kwargs )
215
219
216
220
def create (self ,email ,tos = 1 ,options = None ):
217
221
"""
@@ -242,19 +246,20 @@ def integration(self):
242
246
243
247
def live (self ):
244
248
"""
245
- Puts your account into live mode."
249
+ Puts your account into live mode.
246
250
"""
247
251
data = {'api_key' :self .api_key }
248
252
249
253
return self .get (self .base_url + '/live' ,data = data )
250
254
251
255
class Output (HTTPBackend ):
252
256
""" Gets information regarding outputs """
253
- def __init__ (self ,base_url , api_key , as_xml = False , timeout = None ):
257
+ def __init__ (self ,* args , ** kwargs ):
254
258
"""
255
259
Contains all API methods relating to Outputs.
256
260
"""
257
- super (Output ,self ).__init__ (base_url ,api_key ,as_xml ,'outputs' ,timeout = timeout )
261
+ kwargs ['resource_name' ]= 'outputs'
262
+ super (Output ,self ).__init__ (* args ,** kwargs )
258
263
259
264
def progress (self ,output_id ):
260
265
"""
@@ -276,15 +281,16 @@ class Job(HTTPBackend):
276
281
"""
277
282
Contains all API methods relating to transcoding Jobs.
278
283
"""
279
- def __init__ (self ,base_url , api_key , as_xml = False , timeout = None , test = False ):
284
+ def __init__ (self ,* args , ** kwargs ):
280
285
"""
281
- Initialize a job object
286
+ Initializes a job object
282
287
"""
283
- super (Job ,self ).__init__ (base_url ,api_key ,as_xml ,'jobs' ,timeout = timeout ,test = test )
288
+ kwargs ['resource_name' ]= 'jobs'
289
+ super (Job ,self ).__init__ (* args ,** kwargs )
284
290
285
291
def create (self ,input ,outputs = None ,options = None ):
286
292
"""
287
- Create a job
293
+ Creates a job
288
294
289
295
@param input: the input url as string
290
296
@param outputs: a list of output dictionaries
@@ -303,7 +309,10 @@ def create(self, input, outputs=None, options=None):
303
309
304
310
def list (self ,page = 1 ,per_page = 50 ):
305
311
"""
306
- List some jobs
312
+ Lists some jobs.
313
+
314
+ @param page: <int> the page of results to return
315
+ @param per_page: <int> the number of results per page
307
316
"""
308
317
data = {"api_key" :self .api_key ,
309
318
"page" :page ,