RequestHandler¶
- class core.zowe.core_for_zowe_sdk.RequestHandler(session_arguments)¶
Class used to handle HTTP/HTTPS requests.
- session_arguments¶
Zowe SDK session arguments
- Type
dict
- valid_methods¶
List of supported request methods
- Type
list
- handle_ssl_warnings()¶
Turn off warnings if the SSL verification argument if off.
- normalize_response()¶
Normalize the response object to a JSON format.
- Returns
A normalized JSON for the request response
- Return type
json
- perform_request(method, request_arguments, expected_code=[200])¶
Execute an HTTP/HTTPS requests from given arguments and return validated response (JSON).
- Parameters
method (str) – The request method that should be used
request_arguments (dict) – The dictionary containing the required arguments for the execution of the request
expected_code (int) – The list containing the acceptable response codes (default is [200])
- Returns
normalized_response – normalized request response in json (dictionary)
- Return type
json
- send_request()¶
Build a custom session object, prepare it with a custom request and send it.
- validate_method()¶
Check if the input request method for the request is supported.
- Raises
InvalidRequestMethod – If the input request method is not supported
- validate_response()¶
Validate if request response is acceptable based on expected code list.
- Raises
UnexpectedStatus – If the response status code is not in the expected code list
RequestFailed – If the HTTP/HTTPS request fails