Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
Raises:
TypeError: If the parameter types are incorrect.
"""
check_type(access_token, basestring, may_be_none=False)
check_type(base_url, basestring, may_be_none=False)
check_type(single_request_timeout, int)
check_type(wait_on_rate_limit, bool, may_be_none=False)
check_type(verify, (bool, basestring), may_be_none=False)
check_type(version, basestring, may_be_none=False)
check_type(debug, (bool), may_be_none=False)
super(RestSession, self).__init__()
# Initialize attributes and properties
self._base_url = str(validate_base_url(base_url))
self._get_access_token = get_access_token
self._access_token = str(access_token)
self._single_request_timeout = single_request_timeout
self._wait_on_rate_limit = wait_on_rate_limit
self._verify = verify
self._version = version
self._debug = debug
if debug:
logger.setLevel(logging.DEBUG)
logger.propagate = True
else:
logger.addHandler(logging.NullHandler())
logger.propagate = False
# Initialize a new `requests` session
def base_url(self, value):
"""The base URL for the API endpoints."""
check_type(value, basestring, may_be_none=False)
self._base_url = str(validate_base_url(value))
requests.
verify(bool,basestring): Controls whether we verify the server's
TLS certificate, or a string, in which case it must be a path
to a CA bundle to use.
Raises:
TypeError: If the parameter types are incorrect.
"""
check_type(base_url, basestring, may_be_none=False)
check_type(single_request_timeout, int)
check_type(verify, (bool, basestring), may_be_none=False)
super(Authentication, self).__init__()
self._base_url = str(validate_base_url(base_url))
self._single_request_timeout = single_request_timeout
self._verify = verify
self._request_kwargs = {"timeout": single_request_timeout,
"verify": verify}
self._object_factory = object_factory
def base_url(self, value):
"""The base URL for the API endpoints."""
check_type(value, basestring, may_be_none=False)
self._base_url = str(validate_base_url(value))