@@ -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
@@ -123,7 +123,7 @@ def process(self, http_response, content):
123
123
124
124
class Zencoder (object ):
125
125
""" This is the entry point to the Zencoder API """
126
- def __init__ (self ,api_key = None ,as_xml = False ):
126
+ def __init__ (self ,api_key = None ,as_xml = False , timeout = None ):
127
127
"""
128
128
Initializes Zencoder. You must have a valid API_KEY.
129
129
@@ -143,9 +143,9 @@ def __init__(self, api_key=None, as_xml=False):
143
143
self .api_key = api_key
144
144
145
145
self .as_xml = as_xml
146
- self .job = Job (self .api_key ,self .as_xml )
147
- self .account = Account (self .api_key ,self .as_xml )
148
- self .output = Output (self .api_key ,self .as_xml )
146
+ self .job = Job (self .api_key ,self .as_xml , timeout = timeout )
147
+ self .account = Account (self .api_key ,self .as_xml , timeout = timeout )
148
+ self .output = Output (self .api_key ,self .as_xml , timeout = timeout )
149
149
150
150
class Response (object ):
151
151
"""
@@ -160,11 +160,11 @@ def __init__(self, code, body, raw_body, raw_response):
160
160
161
161
class Account (HTTPBackend ):
162
162
""" Account object """
163
- def __init__ (self ,api_key = None ,as_xml = False ):
163
+ def __init__ (self ,api_key = None ,as_xml = False , timeout = None ):
164
164
"""
165
165
Initializes an Account object
166
166
"""
167
- super (Account ,self ).__init__ (api_key ,as_xml ,'account' )
167
+ super (Account ,self ).__init__ (api_key ,as_xml ,'account' , timeout = timeout )
168
168
169
169
def create (self ,email ,tos = True ,options = None ):
170
170
"""
@@ -203,11 +203,11 @@ def live(self):
203
203
204
204
class Output (HTTPBackend ):
205
205
""" Gets information regarding outputs """
206
- def __init__ (self ,api_key ,as_xml = False ):
206
+ def __init__ (self ,api_key ,as_xml = False , timeout = None ):
207
207
"""
208
208
Contains all API methods relating to Outputs.
209
209
"""
210
- super (Output ,self ).__init__ (api_key ,as_xml ,'outputs' )
210
+ super (Output ,self ).__init__ (api_key ,as_xml ,'outputs' , timeout = timeout )
211
211
212
212
def progress (self ,output_id ):
213
213
"""
@@ -221,11 +221,11 @@ class Job(HTTPBackend):
221
221
"""
222
222
Contains all API methods relating to transcoding Jobs.
223
223
"""
224
- def __init__ (self ,api_key ,as_xml = False ):
224
+ def __init__ (self ,api_key ,as_xml = False , timeout = None ):
225
225
"""
226
226
Initialize a job object
227
227
"""
228
- super (Job ,self ).__init__ (api_key ,as_xml ,'jobs' )
228
+ super (Job ,self ).__init__ (api_key ,as_xml ,'jobs' , timeout = timeout )
229
229
230
230
def create (self ,input ,outputs = None ,options = None ):
231
231
"""