Skip to main content
Version: 16.10.0

word_search

WordSearch

class WordSearch(Library)

A high level Python wrapper for Glasswall WordSearch.

__init__

def __init__(library_path: str)

version

def version()

Returns the Glasswall library version.

Returns:

  • version str - The Glasswall library version.

redact_file

@glasswall.utils.deprecated_alias(xml_config="content_management_policy")
def redact_file(input_file: Union[str, bytes, bytearray, io.BytesIO],
content_management_policy: Union[str, bytes, bytearray,
io.BytesIO],
output_file: Union[None, str] = None,
output_report: Union[None, str] = None,
homoglyphs: Union[None, str, bytes, bytearray,
io.BytesIO] = None,
raise_unsupported: bool = True)

Redacts text from input_file using the given content_management_policy and homoglyphs file, optionally writing the redacted file and report to the paths specified by output_file and output_report.

Arguments:

  • input_file Union[str, bytes, bytearray, io.BytesIO] - The input file path or bytes. content_management_policy (Union[str, bytes, bytearray, io.BytesIO)]): The content management policy to apply.
  • output_file Union[None, str], optional - Default None. If str, write output_file to that path.
  • output_report Union[None, str], optional - Default None. If str, write output_file to that path. homoglyphs (Union[None, str, bytes, bytearray, io.BytesIO)], optional): Default None. The homoglyphs json file path or bytes.
  • raise_unsupported bool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.

Returns:

  • gw_return_object glasswall.GwReturnObj - An instance of class glasswall.GwReturnObj containing attributes: "status" (int), "output_file" (bytes), "output_report" (bytes)

redact_directory

@glasswall.utils.deprecated_alias(xml_config="content_management_policy")
def redact_directory(input_directory: str,
content_management_policy: Union[
str, bytes, bytearray, io.BytesIO,
glasswall.content_management.policies.policy.Policy],
output_directory: Optional[str] = None,
output_report_directory: Optional[str] = None,
homoglyphs: Union[None, str, bytes, bytearray,
io.BytesIO] = None,
raise_unsupported: bool = True)

Redacts all files in a directory and it's subdirectories using the given content_management_policy and homoglyphs file. The redacted files are written to output_directory maintaining the same directory structure as input_directory.

Arguments:

  • input_directory str - The input directory containing files to redact.
  • output_directory str - The output directory where the redacted files will be written.
  • output_report_directory Optional[str], optional - Default None. If str, the output directory where analysis reports for each redacted file will be written. content_management_policy (Union[str, bytes, bytearray, io.BytesIO)]): The content management policy to apply. homoglyphs (Union[None, str, bytes, bytearray, io.BytesIO)], optional): Default None. The homoglyphs file path, str, or bytes.
  • raise_unsupported bool, optional - Default True. Raise exceptions when Glasswall encounters an error. Fail silently if False.

Returns:

  • redacted_files_dict dict - A dictionary of file paths relative to input_directory, and glasswall.GwReturnObj with attributes: "status" (int), "output_file" (bytes), "output_report" (bytes)