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): ...@@ -145,7 +145,7 @@ class Context(object):
raise BadEndpoint("%s (%s)" % (self.endpoint, str(e))), None, sys.exc_info()[2] raise BadEndpoint("%s (%s)" % (self.endpoint, str(e))), None, sys.exc_info()[2]
return endpoint_info 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.passwd = None
self._set_endpoint(endpoint) self._set_endpoint(endpoint)
...@@ -159,13 +159,9 @@ class Context(object): ...@@ -159,13 +159,9 @@ class Context(object):
else: else:
self._set_x509(ucert, ukey) self._set_x509(ucert, ukey)
if (requests): self._requester = request_class(
self._requester = Request( self.ucert, self.ukey, passwd=self.passwd, verify=verify, access_token=self.access_token, capath=capath)
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.ucert, self.ukey, passwd=self.passwd, verify=verify, access_token=self.access_token, capath=capath)
self.endpoint_info = self._validate_endpoint() self.endpoint_info = self._validate_endpoint()
# Log obtained information # Log obtained information
......
...@@ -24,12 +24,12 @@ import os ...@@ -24,12 +24,12 @@ import os
class Request(object): 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.ucert = ucert
self.ukey = ukey self.ukey = ukey
self.passwd = passwd self.passwd = passwd
self.access_token = access_token self.access_token = access_token
self.verify = verify self.verify = False
self.connectTimeout = connectTimeout self.connectTimeout = connectTimeout
self.timeout = timeout 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