4.1.1. taniumpy.object_types package¶
4.1.1.1. Submodules¶
4.1.1.3. taniumpy.object_types.action_list module¶
4.1.1.4. taniumpy.object_types.action_list_info module¶
4.1.1.5. taniumpy.object_types.action_stop module¶
4.1.1.6. taniumpy.object_types.action_stop_list module¶
4.1.1.7. taniumpy.object_types.all_objects module¶
4.1.1.8. taniumpy.object_types.archived_question module¶
4.1.1.9. taniumpy.object_types.archived_question_list module¶
4.1.1.10. taniumpy.object_types.audit_data module¶
4.1.1.11. taniumpy.object_types.base module¶
-
class
taniumpy.object_types.base.
BaseType
(simple_properties, complex_properties, list_properties)[source]¶ Bases:
object
-
append
(n)¶ Allow adding to list.
Only supported on types that have a single property that is in list_properties
-
explode_json
(val)¶
-
flatten_jsonable
(val, prefix)¶
-
classmethod
fromSOAPBody
(body)¶ Parse body (text) and produce Python tanium objects.
This method assumes a single result_object, which may be a list or a single object.
-
classmethod
fromSOAPElement
(el)¶
-
static
from_jsonable
(jsonable)¶ Inverse of to_jsonable, with explode_json_string_values=False.
This can be used to import objects from serialized JSON. This JSON should come from BaseType.to_jsonable(explode_json_string_values=False, include+type=True)
Examples
>>> with open('question_list.json') as fd: ... questions = json.loads(fd.read()) ... # is a list of serialized questions ... question_objects = BaseType.from_jsonable(questions) ... # will return a list of api.Question
-
toSOAPBody
(minimal=False)¶
-
toSOAPElement
(minimal=False)¶
-
to_flat_dict
(prefix='', explode_json_string_values=False)¶ Convert the object to a dict, flattening any lists or nested types
-
to_flat_dict_explode_json
(val, prefix='')¶ see if the value is json. If so, flatten it out into a dict
-
static
to_json
(jsonable, **kwargs)¶ Convert to a json string.
jsonable can be a single BaseType instance of a list of BaseType
-
to_jsonable
(explode_json_string_values=False, include_type=True)¶
-
static
write_csv
(fd, val, explode_json_string_values=False, **kwargs)¶ Write ‘val’ to CSV. val can be a BaseType instance or a list of BaseType
This does a two-pass, calling to_flat_dict for each object, then finding the union of all headers, then writing out the value of each column for each object sorted by header name
explode_json_string_values attempts to see if any of the str values are parseable by json.loads, and if so treat each property as a column value
fd is a file-like object
-
-
exception
taniumpy.object_types.base.
IncorrectTypeException
(property, expected, actual)[source]¶ Bases:
exceptions.Exception
Raised when a property is not of the expected type