Redact and synthesize individual files

Sending a file to Textual

To send an individual .txt or .csv file to Textual, you use textual.start_file_redaction.

You first open the file so that Textual can read it, then make then call for Textual to read the file.

with open("<path to the file>", "r") as f:
    j = textual.start_file_redaction(f,"<file name>")

The response includes:

  • The file name

  • The identifier of the job that processed the file. You use this identifier to retrieve a transformed version of the file.

Getting the file with redacted or synthesized values

After you use textual.start_file_redaction to send the file to Textual, you use tonic.download_redacted_file to retrieve a transformed version of the file.

To identify the file, you use the job identifier that you received from textual.start_file_redaction. You can also specify whether to redact, synthesize, or ignore specific entity types. By default, all of the values are redacted.

Before you make the call to download the file, you specify the path to download the file content to.

with open("<path to output location>", "wb") as fo:
    fo.write(textual.download_redacted_file(<job identifier>)

Last updated