libtaxii.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=True.

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

class libtaxii.common.TAXIIBase

Base class for all TAXII Messages and Message component types.

libtaxii users should not need to use this class directly.

__eq__(other, debug=False)

Generic method used to check equality of objects of any TAXII type.

Also allows for print-based debugging output showing differences.

In order for subclasses to use this function, they must meet the following criteria: 1. All class properties start with one underscore. 2. The sort_key property is implemented.

Parameters:
  • self (object) – this object
  • other (object) – the object to compare self against.
  • debug (bool) – Whether or not to print debug statements as the equality comparison is performed.
classmethod from_dict(d)

Create an instance of this class from a dictionary.

Subclasses must implement this method.

classmethod from_etree(src_etree)

Create an instance of this class from an etree.

Subclasses must implement this method.

classmethod from_xml(xml)

Create an instance of this class from XML.

Subclasses should not need to implement this method.

sort_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_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.

Table Of Contents

Previous topic

libtaxii Module

Next topic

libtaxii.constants Module

This Page

Related Documentation