q2_sdk.hq.http
— Specialized communication functions for HQ
Most of the communication with HQ will be handled in the generated hq_api module.
However, a few specialized pieces such as parsing apart responses and serializing them into objects will be handled here
- q2_sdk.hq.http.get_unhandled_token_response(token)[source]
Generates a UUID to handle preflight HQ GetUnsignedTokenRequest
- Parameters:
token (
UUID
) – UUID returned to HQ.- Return type:
str
- q2_sdk.hq.http.get_backoffice_report_response(root_node, form_data)[source]
Builds a soap envelope to respond to an “ExecuteRequestAsXML” request from HQ :type root_node:
str
:param root_node: Request nodename provided by HQ :type form_data:bytes
:param form_data: Response data- Return type:
str
- q2_sdk.hq.http.get_execute_request_as_xml_response(root_node, form_data, attrs, hq_commands=None)[source]
Builds a soap envelope to respond to an “ExecuteRequestAsXML” request from HQ
- Parameters:
root_node (
str
) – Request nodename provided by HQform_data (
bytes
) – Response dataattrs (
dict
) – Attributes to add to the interior Data node, passed through to HQhq_commands (
Optional
[HqCommands
]) – (Optional) Instance ofHqCommands
to send additional commands with the response
- Return type:
str
- q2_sdk.hq.http.get_execute_request_as_string_response(root_node, response, attrs, hq_commands=None)[source]
Builds a soap envelope to respond to an “ExecuteRequestAsString” request from HQ
- Parameters:
root_node (
str
) – Request nodename provided by HQresponse (
str
) – Response dataattrs (
dict
) – Attributes to add to the interior Data node, passed through to HQ
- Return type:
str
- async q2_sdk.hq.http.call_hq(call, url, logger, hq_token=None, bt_handle=None, response_class=<class 'q2_sdk.hq.models.hq_response.HqResponse'>, backoffice_cookie=None, **kwargs)[source]
Asynchronously calls HQ and returns the response
- Parameters:
call (
Union
[str
,dict
]) – Body to send to HQ endpointurl (
str
) – Hq URL to POST tologger (
TypeAliasType
) – Instantiated Q2Logger objecthq_token (
Optional
[str
]) – Optional token for using existing HQ session (Necessary for wedge_online_banking HQ endpoints)bt_handle (
Optional
[str
]) – If defined, will pass through tracking info to AppDynamicsresponse_class (
Optional
[classmethod
]) – Optional class of object to returnbackoffice_cookie (
Optional
[str
]) – Optional string used for making backoffice calls. Sets the session information.kwargs – Optional keyword args as defined for q2_requests.post() e.g. “timeout”
- Return type: