10.8.2. Results Common Mixins

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

Bases: object

Shared methods common amongst all Result.

__init__(api_objects, response_body, request_body, method, url, status_code, origin=None, lvl='info')[source]

Constructor.

Parameters:
  • api_objects (pytan3.api_objects.ApiObjects) – API Objects Container to use.
  • response_body (str) – Response body received from Tanium API.
  • request_body (str) – Request body sent to Tanium API.
  • method (str) – HTTP method used in request to Tanium API.
  • url (str) – URL used in request to Tanium API.
  • status_code (int) – Status code in response from Tanium API.
  • origin (requests.Response, optional) –

    Original response object received from Tanium API request.

    Defaults to: None.

  • lvl (str, optional) –

    Logging level.

    Defaults to: “info”.

log = None

logging.Logger – Log for this object.

origin = None

requests.Response – Original response object.

__str__()[source]

Show object info.

Returns:str
__repr__()[source]

Show object info.

Returns:str
classmethod from_response(api_objects, response, lvl='info')[source]

Create Result from a requests response object.

Parameters:
Returns:

Result

api_objects

Get the API objects container.

Returns:pytan3.api_objects.ApiObjects
url

Get the URL used in request.

Returns:str
status_code

Get the status code received in response.

Returns:int
method

Get the method used in request.

Returns:str
request_body_str

Get the full request body.

Returns:str
response_body_str

Get the full response body.

Returns:str
obj_to_api(api_name, obj, src)[source]

Deserialize a python object into pytan3.api_models.ApiModel.

Parameters:
  • api_name (str) – API name of obj.
  • obj (object) – Python object to deserialize into a PyTan API object.
  • src (str) – Where obj came from, used in error text.
Returns:

pytan3.api_models.ApiModel

get_dict_path(obj, path, src)[source]

Traverse a dict using a / seperated string.

Parameters:
  • obj (dict) – Dictionary to traverse using path.
  • path (str) – Nested dictionary keys seperated by / to traverse in obj.
  • src (str) – Where obj came from, used in error text.
Raises:

exceptions.DictionaryPathError – If any error occurs while traversing path in obj.

Returns:

object