|
|
@ -335,7 +335,8 @@ class DecortController(object):
|
|
|
|
|
|
|
|
|
|
|
|
return True
|
|
|
|
return True
|
|
|
|
|
|
|
|
|
|
|
|
def decort_api_call(self, arg_req_function, arg_api_name, arg_params, arg_files=None):
|
|
|
|
def decort_api_call(self, arg_req_function, arg_api_name, arg_params,
|
|
|
|
|
|
|
|
arg_files=None, not_fail_codes: None | list = None):
|
|
|
|
"""Wrapper around DECORT API calls. It uses authorization mode and credentials validated at the class
|
|
|
|
"""Wrapper around DECORT API calls. It uses authorization mode and credentials validated at the class
|
|
|
|
instance creation to properly format API call and send it to the DECORT controller URL.
|
|
|
|
instance creation to properly format API call and send it to the DECORT controller URL.
|
|
|
|
If connection errors are detected, it aborts execution of the script and relay error messages to upstream
|
|
|
|
If connection errors are detected, it aborts execution of the script and relay error messages to upstream
|
|
|
@ -386,6 +387,8 @@ class DecortController(object):
|
|
|
|
|
|
|
|
|
|
|
|
if api_resp.status_code == 200:
|
|
|
|
if api_resp.status_code == 200:
|
|
|
|
return api_resp
|
|
|
|
return api_resp
|
|
|
|
|
|
|
|
elif not_fail_codes and api_resp.status_code in not_fail_codes:
|
|
|
|
|
|
|
|
return api_resp
|
|
|
|
elif api_resp.status_code == 503:
|
|
|
|
elif api_resp.status_code == 503:
|
|
|
|
retry_timeout = 5 + 10 * (max_retries - retry_counter)
|
|
|
|
retry_timeout = 5 + 10 * (max_retries - retry_counter)
|
|
|
|
time.sleep(retry_timeout)
|
|
|
|
time.sleep(retry_timeout)
|
|
|
|