Add annotation for result of the method `DecortController.decort_api_call` and improve its docstring code style

main
Dmitriy Smirnov 7 months ago
parent 53938d9d94
commit 0cdfa6a0ec

@ -436,21 +436,37 @@ class DecortController(object):
return True return True
def decort_api_call(self, arg_req_function, arg_api_name, arg_params, def decort_api_call(
arg_files=None, not_fail_codes: None | list = None): self,
"""Wrapper around DECORT API calls. It uses authorization mode and credentials validated at the class arg_api_name,
instance creation to properly format API call and send it to the DECORT controller URL. arg_params,
If connection errors are detected, it aborts execution of the script and relay error messages to upstream arg_req_function,
Ansible process. arg_files=None,
If HTTP 503 error is detected the method will retry with increasing timeout, and if after max_retries there not_fail_codes: None | list = None,
still is HTTP 503 error, it will abort as above. ) -> requests.Response:
If any other HTTP error is detected, the method will abort immediately as above. """
Wrapper around DECORT API calls. It uses authorization mode and
@param arg_req_function: function object to be called as part of API, e.g. requests.post or requests.get credentials validated at the class instance creation
@param arg_api_name: a string containing the path to the API name under DECORT controller URL to properly format API call and send it to
@param arg_params: a dictionary containing parameters to be passed to the API call the DECORT controller URL.
If connection errors are detected, it aborts execution of
@return: api call response object as returned by the REST functions from Python "requests" module the script and relay error messages to upstream Ansible process.
If HTTP 503 error is detected the method will retry with
increasing timeout, and if after max_retries there still is
HTTP 503 error, it will abort as above. If any other HTTP error
is detected, the method will abort immediately as above.
@param arg_api_name: a string containing the path to
the API name under DECORT controller URL
@param arg_params: a dictionary containing parameters to be
passed to the API call
@param arg_req_function: function object to be called as
part of API, e.g. requests.post or requests.get
@return: api call response object as returned by
the REST functions from Python "requests" module
""" """
max_retries = 5 max_retries = 5

Loading…
Cancel
Save