diff --git a/modules/RestApiClient.py b/modules/RestApiClient.py index d27ef0f..734433c 100755 --- a/modules/RestApiClient.py +++ b/modules/RestApiClient.py @@ -88,9 +88,12 @@ def __init__(self, config_section='DEFAULT', version=None, config=None): context.check_hostname = False check_hostname = False - # Instead of loading the default certificates load only the - # certificates specified by the user. - context.load_verify_locations(cafile=certificate_file) + if str( certificate_file ).lower() == "false": + context.verify_mode = ssl.CERT_NONE + else: + # Instead of loading the default certificates load only the + # certificates specified by the user. + context.load_verify_locations(cafile=certificate_file) else: if sys.version_info >= (3, 4): # Python 3.4 and above has the improved load_default_certs() @@ -108,7 +111,7 @@ def __init__(self, config_section='DEFAULT', version=None, config=None): # This method is used to set up an HTTP request and send it to the server def call_api(self, endpoint, method, headers=None, params=[], data=None, - print_request=False): + print_request=False, timeout=10): path = self.parse_path(endpoint, params) @@ -131,7 +134,7 @@ def call_api(self, endpoint, method, headers=None, params=[], data=None, headers=actual_headers) try: - response = urlopen(request, data) + response = urlopen(request, data, timeout=timeout) response_info = response.info() if 'Deprecated' in response_info: diff --git a/modules/arielapiclient.py b/modules/arielapiclient.py index 34ff148..1833c6b 100755 --- a/modules/arielapiclient.py +++ b/modules/arielapiclient.py @@ -12,13 +12,13 @@ class APIClient(RestApiClient): # This class will encode any data or query parameters which will then be # sent to the call_api() method of its inherited class. - def __init__(self, config_section='DEFAULT', config=None): + def __init__(self, config_section='DEFAULT', version='6.0', config=None): # This version of the ariel APIClient is designed to function with # version 6.0 of the ariel API. self.endpoint_start = 'ariel/' super(APIClient, self).__init__(config_section=config_section, - version='6.0', config=config) + version=version, config=config) def get_databases(self):