Commit bbe617a3 authored by Maria Arsuaga Rios's avatar Maria Arsuaga Rios
Browse files

FTS-405: using request_class parameter

parent a1f6cc02
......@@ -145,7 +145,7 @@ class Context(object):
raise BadEndpoint("%s (%s)" % (self.endpoint, str(e))), None, sys.exc_info()[2]
return endpoint_info
def __init__(self, endpoint, ucert=None, ukey=None, verify=True, access_token=None, no_creds=False, capath=None, requests=False):
def __init__(self, endpoint, ucert=None, ukey=None, verify=True, access_token=None, no_creds=False, capath=None, request_class=PycurlRequest):
self.passwd = None
self._set_endpoint(endpoint)
......@@ -159,14 +159,10 @@ class Context(object):
else:
self._set_x509(ucert, ukey)
if (requests):
self._requester = Request(
self.ucert, self.ukey, passwd=self.passwd, verify=False, access_token=self.access_token)
log.debug("Using requests API without verification")
else:
self._requester = PycurlRequest(
self._requester = request_class(
self.ucert, self.ukey, passwd=self.passwd, verify=verify, access_token=self.access_token, capath=capath)
self.endpoint_info = self._validate_endpoint()
# Log obtained information
log.debug("Using endpoint: %s" % self.endpoint_info['url'])
......
......@@ -24,12 +24,12 @@ import os
class Request(object):
def __init__(self, ucert, ukey, passwd=None, verify=False, access_token=None, connectTimeout=30, timeout=30):
def __init__(self, ucert, ukey, capath=None, passwd=None, verify=False, access_token=None, connectTimeout=30, timeout=30):
self.ucert = ucert
self.ukey = ukey
self.passwd = passwd
self.access_token = access_token
self.verify = verify
self.verify = False
self.connectTimeout = connectTimeout
self.timeout = timeout
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment