Skip to main content

Glasswall Python Wrapper

A high level Python wrapper for interfacing with Glasswall libraries.

Getting Started

Install via pip:

pip install glasswall

Prerequisites

Examples

Loading a Glasswall Library

Currently the following libraries are supported:

  • ArchiveManager
  • Editor
  • Rebuild
  • SecurityTagging
  • WordSearch
import glasswall


editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
>>> 2021-03-15 12:27:42.337 glasswall INFO     __init__                  Loaded Glasswall Editor version 2.173 from C:\azure\sdk.editor\2.173\windows-drop-no-kill-switch\glasswall_core2.dll

library_path can be a path to a directory or a path to a file. When a directory is specified all subdirectories are recursively searched for the library file with the latest creation time.

Logging

Logs are saved in the OS-specific temp directory and are also output to console with a default logging level of INFO. You can view the file path of the temp directory or the log file:

import glasswall


print(glasswall._TEMPDIR)
print(glasswall.config.logging.log_file_path)
>>> C:\Users\ANGUSR~1\AppData\Local\Temp\glasswall
>>> C:\Users\ANGUSR~1\AppData\Local\Temp\glasswall\logs\2021-03-15 122826.txt

The logging level can be modified, for a list of levels see: https://docs.python.org/3/library/logging.html#logging-levels

import logging

import glasswall

# Modify logging level for logs to the console
glasswall.config.logging.console.setLevel(logging.DEBUG)

# Modify logging level for logs to file
glasswall.config.logging.log.setLevel(logging.DEBUG)
Protecting a directory

If no content management policy is provided then the default sanitise all policy is used.

import glasswall


editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
editor.protect_directory(
    input_directory=r"C:\test_files",
    output_directory=r"C:\test_files_sanitised"
)
Protecting a directory with a customised content management policy

Using glasswall.content_management.policies.Editor:

import glasswall


editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
editor.protect_directory(
    input_directory=r"C:\test_files",
    output_directory=r"C:\test_files_sanitised",
    content_management_policy=glasswall.content_management.policies.Editor(
        config={
            "pptConfig": {
                "internal_hyperlinks": "allow",
                "macros": "disallow",
            },
            "wordConfig": {
                "internal_hyperlinks": "allow",
                "macros": "disallow",
            }
        }
    )
)

Using a custom .xml file:

import glasswall


editor = glasswall.Editor(library_path=r"C:\azure\sdk.editor\2.173")
editor.protect_directory(
    input_directory=r"C:\test_files",
    output_directory=r"C:\test_files_sanitised",
    content_management_policy=r"C:\configs\config.xml"
)

Built With

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

glasswall-0.1.1.tar.gz (41.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

glasswall-0.1.1-py3-none-any.whl (64.0 kB view details)

Uploaded Python 3

File details

Details for the file glasswall-0.1.1.tar.gz.

File metadata

  • Download URL: glasswall-0.1.1.tar.gz
  • Upload date:
  • Size: 41.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for glasswall-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7f804edb48f579a464b29643faf2dc98bed0ff17c2ca60dfa7dae74a0543f6f4
MD5 d0e5783e8682056483705c5106a9375c
BLAKE2b-256 7a40f1eced0507a8f7c3d6a2f1349658f588f36783c8d6c3647a0234b5e7e9de

See more details on using hashes here.

File details

Details for the file glasswall-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: glasswall-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 64.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.0 importlib_metadata/3.7.3 packaging/20.9 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

File hashes

Hashes for glasswall-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 768e2d603e614c6ec6d2fb8d2453e9ad08c2aa4a8fa29a699805203f128aad0f
MD5 0c560b47954c8dc00eb4ae6f7a17513f
BLAKE2b-256 ac58ac1408e6549175fa1783e0554e80a90a9fedfc333e6a3f67385c70d827b1

See more details on using hashes here.

Release history Release notifications | RSS feed

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page