Utils#

class gvm.utils.TypesDict#

For dot.notation access to dictionary attributes

gvm.utils.check_command_status(xml)#

Check gmp response

Look into the gmp response and check for the status in the root element

Parameters:

xml (str) – XML-Source

Returns:

True if valid, otherwise False

Return type:

bool

gvm.utils.to_dotted_types_dict(types)#

Create a dictionary accessible via dot notation

XML#

gvm.xml.pretty_print(xml, file=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>)#

Prints beautiful XML-Code

This function gets a string containing the xml, an object of List[lxml.etree.Element] or directly a lxml element.

Print it with good readable format.

Parameters:
  • xml (str, List[lxml.etree.Element] or lxml.etree.Element) – xml as string, List[lxml.etree.Element] or directly a lxml element.

  • file (IOBase) – A IOBase type. Can be a File, StringIO, …

gvm.xml.validate_xml_string(xml_string)#

Checks if the passed string contains valid XML

Raises a GvmError if the XML is invalid. Otherwise the function just returns.

Parameters:

xml_string (str) – XML string to validate

Raises:

GvmError – The xml string did contain invalid XML