@@ -31,7 +31,7 @@ class HTTPBackend(object):
31
31
32
32
@FIXME: Build in support for supplying arbitrary backends
33
33
"""
34
- def __init__ (self , api_key , as_xml = False , resource_name = None , timeout = None ):
34
+ def __init__ (self , api_key , as_xml = False , resource_name = None , timeout = None , test = False ):
35
35
"""
36
36
Creates an HTTPBackend object, which abstracts out some of the
37
37
library specific HTTP stuff.
@@ -44,6 +44,7 @@ def __init__(self, api_key, as_xml=False, resource_name=None, timeout=None):
44
44
self .http = httplib2 .Http (timeout = timeout )
45
45
self .as_xml = as_xml
46
46
self .api_key = api_key
47
+ self .test = test
47
48
48
49
if self .as_xml :
49
50
self .headers = {'Content-Type' : 'application/xml' ,
@@ -123,7 +124,7 @@ def process(self, http_response, content):
123
124
124
125
class Zencoder (object ):
125
126
""" This is the entry point to the Zencoder API """
126
- def __init__ (self , api_key = None , as_xml = False , timeout = None ):
127
+ def __init__ (self , api_key = None , as_xml = False , timeout = None , test = False ):
127
128
"""
128
129
Initializes Zencoder. You must have a valid API_KEY.
129
130
@@ -142,8 +143,9 @@ def __init__(self, api_key=None, as_xml=False, timeout=None):
142
143
else :
143
144
self .api_key = api_key
144
145
146
+ self .test = test
145
147
self .as_xml = as_xml
146
- self .job = Job (self .api_key , self .as_xml , timeout = timeout )
148
+ self .job = Job (self .api_key , self .as_xml , timeout = timeout , test = self . test )
147
149
self .account = Account (self .api_key , self .as_xml , timeout = timeout )
148
150
self .output = Output (self .api_key , self .as_xml , timeout = timeout )
149
151
@@ -221,11 +223,11 @@ class Job(HTTPBackend):
221
223
"""
222
224
Contains all API methods relating to transcoding Jobs.
223
225
"""
224
- def __init__ (self , api_key , as_xml = False , timeout = None ):
226
+ def __init__ (self , api_key , as_xml = False , timeout = None , test = False ):
225
227
"""
226
228
Initialize a job object
227
229
"""
228
- super (Job , self ).__init__ (api_key , as_xml , 'jobs' , timeout = timeout )
230
+ super (Job , self ).__init__ (api_key , as_xml , 'jobs' , timeout = timeout , test = test )
229
231
230
232
def create (self , input , outputs = None , options = None ):
231
233
"""
@@ -235,7 +237,9 @@ def create(self, input, outputs=None, options=None):
235
237
@param outputs: a list of output dictionaries
236
238
@param options: a dictionary of job options
237
239
"""
238
- data = {"api_key" : self .api_key , "input" : input }
240
+ as_test = int (self .test )
241
+
242
+ data = {"api_key" : self .api_key , "input" : input , "test" : as_test }
239
243
if outputs :
240
244
data ['outputs' ] = outputs
241
245
0 commit comments