10.8.3.1. Soap Result

class pytan3.results.Soap(api_objects, response_body, request_body, method, url, status_code, origin=None, lvl='info')[source]

Bases: pytan3.results.CommonMixin, pytan3.results.Result

Deserialize SOAP API responses from Tanium API.

DATA_ROUTES = ['GetResultInfo', 'GetResultData', 'GetMergedResultData']
__call__(raw=False, **kwargs)[source]

Get data_api or object_api.

Parameters:
  • raw (bool, optional) –

    Return the serialized object instead of the object deserialized into an ApiModel.

    Defaults to: False.

  • **kwargs
    rest of kwargs:
    passed to object_api() or data_api().

Notes

Will return object_api() or data_api() by determining if command_request is an object or data request.

Returns:pytan3.api_models.ApiModel or object
error_map

Map of status codes to regex patterns and exceptions.

Notes

Keys should be int of a status code to check patterns of.

Values should be list of [pattern, exc], where pattern is a regex pattern to search response body, and exc is exception to throw if pattern match is found.

Raises:
Returns:

dict

error_check()[source]

Check for errors in CommonMixin.response_body_str.

Raises:
error_check_response()[source]

Check Soap.command_response for errors.

Notes

For each key value pair in error_map, if key matches CommonMixin.status_code or key is None, the patterns in value are checked against response body, and if matched the patterns associated exception is thrown.

error_check_code()[source]

Check if CommonMixin.status_code is one of valid_codes.

Raises:exceptions.ResponseError
valid_codes

List of valid status codes.

Returns:list of int
error_text

Get the error text from CommonMixin.response_body_str.

Returns:str
command_request

Get the “command” element from request_body_obj.

Returns:str
command_response

Get the “command” element from response_body_obj.

Returns:str
request_body_obj

Deserialize CommonMixin.request_body_str into a python object.

Returns:dict
request_object_obj

Get the request objects from request_body_obj.

Returns:dict
response_body_obj

Get CommonMixin.response_body_str deserialized into a python object.

Returns:dict
data_xml

Get the “ResultXML” element from response_body_obj.

Returns:str
data_obj

Get the response data from data_xml.

Returns:object
data_api(**kwargs)[source]

Get data_obj deserialized into an ApiModel object.

Parameters:**kwargs
rest of kwargs:
passed to CommonMixin.obj_to_api()
Returns:pytan3.api_models.ApiModel
object_obj

Get the response objects from response_body_obj.

Returns:dict
object_api(**kwargs)[source]

Get object_obj deserialized into an ApiModel object.

Parameters:**kwargs
rest of kwargs:
passed to CommonMixin.obj_to_api()
Returns:pytan3.api_models.ApiModel
str_to_obj(text, src, use_dict=True, try_int=True, flat_attrs=True, **kwargs)[source]

Deserialize string into a python object.

Parameters:
  • text (str) – String to decode into python object
  • src (str) – Where text came from, used in error text.
  • use_dict (bool) –

    Use dict instead of collections.OrderedDict when deserializing.

    Defaults to: True.

  • try_int (bool) –

    Try to convert str into int when deserializing.

    Defaults to: True.

  • flat_attrs (bool) –

    Make attr_prefix “” and cdata_key “text”.

    Defaults to: True.

  • **kwargs
    rest of kwargs:
    Passed to xmltodict.parse.
Raises:

exceptions.TextDeserializeError – If an exception is thrown from xmltodict.parse.

Returns:

dict

_abc_impl = <_abc_data object>