This is a CLI tool that redacts emails from bodies of text in a PostgreSQL database.
Project description
redacty
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.
- Github repository: https://github.com/wet-bulb/redacty/
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redacty-2.0.1.tar.gz.
File metadata
- Download URL: redacty-2.0.1.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1037-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cf6d37d337501a26aa52649d7995c7aa3c695974564081ac7e330dad11bce631
|
|
| MD5 |
07f727691266b910e1bd1c75899480f2
|
|
| BLAKE2b-256 |
6852d7aa5ada2d681f3510f0138767f0b85debe5e4ad504089806f34fbe0a341
|
File details
Details for the file redacty-2.0.1-py3-none-any.whl.
File metadata
- Download URL: redacty-2.0.1-py3-none-any.whl
- Upload date:
- Size: 5.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.4.2 CPython/3.11.3 Linux/5.15.0-1037-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afc405813bd4c1ad2f91fd50d5d946dbe133c25c3ae819a3ed63f56de921e12c
|
|
| MD5 |
3112c05c918dc5873808bec6c4320701
|
|
| BLAKE2b-256 |
eee761eaa33e0bc5158566c1ad612f269d112331bea1dac83564aa903d17463b
|