BackOfficeResponse

class q2_sdk.hq.models.backoffice_response.BackOfficeResponse(raw_response, logger=None)[source]

Wraps a response from HQ up as a handy object to work with.

For responses containing DataSet structures (XSD schemas + diffgram rows), .json() will use the embedded schema to return properly-typed Python dicts with consistent list structures for table rows.

For simple responses without DataSet structures, .json() falls back to the generic xml_to_dict behavior.

Parameters:

response – Body of HQ response

clean_result_node()[source]

Cleans up the grossness of the BackOffice response in a few ways:

  1. Removes namespaces

  2. Moves children of diffgrams to the diffgram’s parent

  3. Removes the diffgram node

  4. Removes schema nodes

  5. Objects from BackOffice typically have a parent and child node named the same thing. Only store the child

json()[source]

Convert the response to a Python dictionary.

For DataSet responses (those with embedded XSD schemas), returns a dict with properly-typed values and consistent list structures for table rows.

For simple responses without DataSet structures, falls back to the generic xml_to_dict parsing from HqResponse.

Return type:

dict

static get_hq_return_error(inner_response)[source]

Parses HQ response and returns an error message if one exists

Parameters:

inner_response (Element) – Result Node from HQ response