Skip to main content

redacty

Release Build status Supported Python versions codecov Commit activity License

This is a CLI tool and Python API that redacts emails from bodies of text in a PostgreSQL database, with optional flags for an excluded domain and an older than x days filter.

Installation

Install redacty with pip

  pip install redacty

Usage/Examples

Command-Line Interface (CLI)

redacty <database_url> <table> <column> [-a AGE] [-x EXCLUDE]
  • database_url: PostgreSQL database URL.
  • table: Name of the table that holds the column to redact.
  • column: Name of the column that holds the text to redact.

Optional arguments:

  • -a AGE, --age AGE: Minimum age of records to be anonymized in days. Default is 0 days old.
  • -x EXCLUDE, --exclude EXCLUDE: Email domain to exclude from anonymization.

Programatic Use in Python

Here's an example:

from redacty import anonymize_records

# Connect to the PostgreSQL database
conn = psycopg2.connect(database_url)

# Anonymize email addresses in the specified table and column, set minimum age, and no excluded domains
anonymize_records(conn, table, column, 30, " ")

# Close the database connection
conn.close()

Repository initiated with fpgmaas/cookiecutter-poetry.

Metadata

Release files for redacty 2.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for redacty 2.0.1
File Size Uploaded
redacty-2.0.1.tar.gz 4.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for redacty 2.0.1
File Interpreter ABI Platform
redacty-2.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 9.6 kB

Release files / redacty-2.0.1.tar.gz

Download URL redacty-2.0.1.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cf6d37d337501a26aa52649d7995c7aa3c695974564081ac7e330dad11bce631
BLAKE2b-256 checksum
How to use checksums
6852d7aa5ada2d681f3510f0138767f0b85debe5e4ad504089806f34fbe0a341
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1037-azure

Release files / redacty-2.0.1-py3-none-any.whl

Download URL redacty-2.0.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
afc405813bd4c1ad2f91fd50d5d946dbe133c25c3ae819a3ed63f56de921e12c
BLAKE2b-256 checksum
How to use checksums
eee761eaa33e0bc5158566c1ad612f269d112331bea1dac83564aa903d17463b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1037-azure

Release history Release notifications | RSS feed

This release

2.0.1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page