@@ -39,8 +39,7 @@ def __init__(self,
3939test = False ,
4040version = None ,
4141proxies = None ,
42- cert = None ,
43- http_timeout = None ):
42+ verify = True ):
4443
4544self .base_url = base_url
4645
@@ -49,10 +48,13 @@ def __init__(self,
4948
5049self .http = requests .Session ()
5150
52- # set requests additional settings. `None` is default for all of these settings
53- self .http .timeout = http_timeout
54- self .http .proxies = proxies
55- self .http .cert = cert
51+ # set requests additional settings.
52+ # `None` is default for all of these settings.
53+ self .requests_params = {
54+ 'timeout' :timeout ,
55+ 'proxies' :proxies ,
56+ 'verify' :verify
57+ }
5658
5759self .api_key = api_key
5860self .test = test
@@ -80,26 +82,38 @@ def delete(self, url, params=None):
8082
8183 ``params`` should be a dictionary
8284 """
83- response = self .http .delete (url ,params = params )
85+ response = self .http .delete (url ,
86+ params = params ,
87+ ** self .requests_params )
8488return self .process (response )
8589
8690def get (self ,url ,data = None ):
8791""" Executes an HTTP GET request for the given URL.
8892
8993 ``data`` should be a dictionary of url parameters
9094 """
91- response = self .http .get (url ,headers = self .headers ,params = data )
95+ response = self .http .get (url ,
96+ headers = self .headers ,
97+ params = data ,
98+ ** self .requests_params )
9299return self .process (response )
93100
94101def post (self ,url ,body = None ):
95102""" Executes an HTTP POST request for the given URL. """
96- response = self .http .post (url ,data = body ,headers = self .headers )
103+ response = self .http .post (url ,
104+ headers = self .headers ,
105+ data = body ,
106+ ** self .requests_params )
97107
98108return self .process (response )
99109
100110def put (self ,url ,data = None ,body = None ):
101111""" Executes an HTTP PUT request for the given URL. """
102- response = self .http .put (url ,params = data ,data = body ,headers = self .headers )
112+ response = self .http .put (url ,
113+ headers = self .headers ,
114+ data = body ,
115+ params = data ,
116+ ** self .requests_params )
103117
104118return self .process (response )
105119
@@ -135,8 +149,17 @@ class Zencoder(object):
135149
136150 Set ``api_version='edge'`` to get the Zencoder development API.
137151 (defaults to 'v2')
152+
153+ ``timeout``, ``proxies`` and ``verify`` can be set to control the
154+ underlying HTTP requests that are made.
138155 """
139- def __init__ (self ,api_key = None ,api_version = None ,timeout = None ,test = False ):
156+ def __init__ (self ,
157+ api_key = None ,
158+ api_version = None ,
159+ timeout = None ,
160+ test = False ,
161+ proxies = None ,
162+ verify = True ):
140163if not api_version :
141164api_version = 'v2'
142165
@@ -155,7 +178,13 @@ def __init__(self, api_key=None, api_version=None, timeout=None, test=False):
155178self .test = test
156179
157180args = (self .base_url ,self .api_key )
158- kwargs = dict (timeout = timeout ,test = self .test ,version = api_version )
181+
182+ kwargs = dict (timeout = timeout ,
183+ test = self .test ,
184+ version = api_version ,
185+ proxies = proxies ,
186+ verify = verify )
187+
159188self .job = Job (* args ,** kwargs )
160189self .account = Account (* args ,** kwargs )
161190self .output = Output (* args ,** kwargs )