@@ -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 ):
34
+ def __init__ (self , api_key , as_xml = False , resource_name = None , timeout = None ):
35
35
"""
36
36
Creates an HTTPBackend object, which abstracts out some of the
37
37
library specific HTTP stuff.
@@ -41,7 +41,7 @@ def __init__(self, api_key, as_xml=False, resource_name=None):
41
41
self .base_url = self .base_url + resource_name
42
42
43
43
#TODO investigate httplib2 caching and if it is necessary
44
- self .http = httplib2 .Http ()
44
+ self .http = httplib2 .Http (timeout = timeout )
45
45
self .as_xml = as_xml
46
46
self .api_key = api_key
47
47
@@ -122,7 +122,7 @@ def process(self, http_response, content):
122
122
123
123
class Zencoder (object ):
124
124
""" This is the entry point to the Zencoder API """
125
- def __init__ (self , api_key = None , as_xml = False ):
125
+ def __init__ (self , api_key = None , as_xml = False , timeout = None ):
126
126
"""
127
127
Initializes Zencoder. You must have a valid API_KEY.
128
128
@@ -142,9 +142,9 @@ def __init__(self, api_key=None, as_xml=False):
142
142
self .api_key = api_key
143
143
144
144
self .as_xml = as_xml
145
- self .job = Job (self .api_key , self .as_xml )
146
- self .account = Account (self .api_key , self .as_xml )
147
- self .output = Output (self .api_key , self .as_xml )
145
+ self .job = Job (self .api_key , self .as_xml , timeout = timeout )
146
+ self .account = Account (self .api_key , self .as_xml , timeout = timeout )
147
+ self .output = Output (self .api_key , self .as_xml , timeout = timeout )
148
148
149
149
class Response (object ):
150
150
"""
@@ -159,11 +159,11 @@ def __init__(self, code, body, raw_body, raw_response):
159
159
160
160
class Account (HTTPBackend ):
161
161
""" Account object """
162
- def __init__ (self , api_key = None , as_xml = False ):
162
+ def __init__ (self , api_key = None , as_xml = False , timeout = None ):
163
163
"""
164
164
Initializes an Account object
165
165
"""
166
- super (Account , self ).__init__ (api_key , as_xml , 'account' )
166
+ super (Account , self ).__init__ (api_key , as_xml , 'account' , timeout = timeout )
167
167
168
168
def create (self , email , tos = True , options = None ):
169
169
"""
@@ -204,11 +204,11 @@ def live(self):
204
204
205
205
class Output (HTTPBackend ):
206
206
""" Gets information regarding outputs """
207
- def __init__ (self , api_key , as_xml = False ):
207
+ def __init__ (self , api_key , as_xml = False , timeout = None ):
208
208
"""
209
209
Contains all API methods relating to Outputs.
210
210
"""
211
- super (Output , self ).__init__ (api_key , as_xml , 'outputs' )
211
+ super (Output , self ).__init__ (api_key , as_xml , 'outputs' , timeout = timeout )
212
212
213
213
def progress (self , output_id ):
214
214
"""
@@ -222,11 +222,11 @@ class Job(HTTPBackend):
222
222
"""
223
223
Contains all API methods relating to transcoding Jobs.
224
224
"""
225
- def __init__ (self , api_key , as_xml = False ):
225
+ def __init__ (self , api_key , as_xml = False , timeout = None ):
226
226
"""
227
227
Initialize a job object
228
228
"""
229
- super (Job , self ).__init__ (api_key , as_xml , 'jobs' )
229
+ super (Job , self ).__init__ (api_key , as_xml , 'jobs' , timeout = timeout )
230
230
231
231
def create (self , input , outputs = None , options = None ):
232
232
"""
0 commit comments