common Module

Common utility classes and functions used throughout libtaxii.

Functions

libtaxii.common.get_xml_parser()

Return the XML parser currently in use.

If one has not already been set (via set_xml_parser()), a new etree.XMLParser is constructed with no_network=True and huge_tree=False.

libtaxii.common.set_xml_parser(xml_parser=None)

Set the libtaxii.messages XML parser.

Parameters:

xml_parser (etree.XMLParser) – The parser to use to parse TAXII XML.

Classes

classlibtaxii.common.TAXIIBase

Base class for all TAXII Messages and Message component types.

libtaxii users should not need to use this class directly.

classmethodfrom_dict(d)

Create an instance of this class from a dictionary.

Subclasses must implement this method.

classmethodfrom_etree(src_etree)

Create an instance of this class from an etree.

Subclasses must implement this method.

classmethodfrom_xml(xml)

Create an instance of this class from XML.

Subclasses should not need to implement this method.

propertysort_key

This property allows list of TAXII objects to be compared efficiently. The __eq__ method uses this property to sort the lists before comparisons are made.

Subclasses must implement this property.

to_dict()

Create a dictionary representation of this class.

Subclasses must implement this method.

to_etree()

Create an etree representation of this class.

Subclasses must implement this method.

to_json()

Create a JSON object of this class.

Assumes any binary content will be UTF-8 encoded.

to_text(line_prepend='')

Create a nice looking (this is a subjective term!) textual representation of this class. Subclasses should implement this method.

Note that this is just a convenience method for making TAXII Messages nice to read for humans and may change drastically in future versions of libtaxii.

to_xml(pretty_print=False)

Create an XML representation of this class.

Subclasses should not need to implement this method.