Skip to main content

libraries.security_tagging.security_tagging

ct​

os​

sys​

utils​

log​

Library​

errors​

successes​

SecurityTagging Objects​

class SecurityTagging(Library)

A high level Python wrapper for Glasswall Security Tagging.

__init__​

def __init__(library_path: str)

version​

def version()

Returns the Glasswall library version.

Returns:

  • version str - The Glasswall library version.

tag_file​

def tag_file(tags_path: str,
input_file: str,
output_file: str,
raise_unsupported: bool = True)

Tags the input_file with xml loaded from tags_path, writing to output_file.

Arguments:

  • tags_path str - The path to the .xml file containing tags to add.
  • input_file str - The path to the input file.
  • output_file str - The path to the output file where the tagged input_file will be written to.
  • raise_unsupported bool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.

Returns:

  • status int - An integer indicating the file process status.

Raises:

  • TypeError - If any arguments are of incorrect type.
  • NotImplementedError - If raise_unsupported is True and the status of calling GWSecuTag_TagFile is not 1 (success)

tag_directory​

def tag_directory(tags_path: str,
input_directory: str,
output_directory: str,
raise_unsupported: bool = True)

Tags all files in input_directory with the xml loaded from tags_path, writing to output_directory and maintaining the same directory structure.

Arguments:

  • tags_path str - The path to the .xml file containing tags to add.
  • input_directory str - The path to the input directory.
  • output_directory str - The path to the output directory where the tagged files will be written to.
  • raise_unsupported bool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.

Returns:

  • status int - An integer indicating the file process status.

Raises:

  • TypeError - If any arguments are of incorrect type.
  • NotImplementedError - If raise_unsupported is True and the status of calling GWSecuTag_TagFile is not 1 (success)

retrieve_tags​

def retrieve_tags(input_file: str, output_file: str, raise_unsupported=True)

Retrieves the xml tags of the input_file and writes it to output_file.

Arguments:

  • input_file str - The path to the input file.
  • output_file str - The path to the output file where the xml tags will be written to.
  • raise_unsupported bool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.

Returns:

  • status int - An integer indicating the file process status.

Raises:

  • TypeError - If any arguments are of incorrect type.
  • NotImplementedError - If raise_unsupported is True and the status of calling GWSecuTag_RetrieveTagFile is not 1 (success)

retrieve_tags_directory​

def retrieve_tags_directory(input_directory: str,
output_directory: str,
raise_unsupported=True)

Retrieves all tags from files in input_directory, writing XML to output_directory and maintaining the same directory structure.

Arguments:

  • input_directory str - The path to the input directory.
  • output_directory str - The path to the output directory where the tagged files will be written to.
  • raise_unsupported bool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.

Returns:

  • status int - The status of the function call.

Raises:

  • TypeError - If any arguments are of incorrect type.
  • NotImplementedError - If raise_unsupported is True and the status of calling GWSecuTag_RetrieveTagFile is not 1 (success)