Argus Redact
raw JSON → 0.6.5 verified Sat May 09 auth: no python
A Python library for local PII redaction that encrypts personally identifiable information in text while preserving contextual meaning. The current version is 0.6.5, updated as of late 2024. Release cadence is irregular, with occasional dependency updates.
pip install argus-redact Common errors
error ModuleNotFoundError: No module named 'argus_redact' ↓
cause Python environment does not have argus-redact installed, or import path is incorrect.
fix
Install via pip: pip install argus-redact. Ensure no typo in module name (use underscore).
error InvalidToken: The token is invalid ↓
cause The encryption key used for decryption does not match the key used during redaction.
fix
Use the same key for both redaction and decryption. Keys are case-sensitive and must be identical.
error AttributeError: module 'argus_redact' has no attribute 'Redactor' ↓
cause Wrong import path, possibly confusing with older API versions.
fix
Use: from argus_redact import Redactor
error ValueError: key must be 16 or 32 bytes long ↓
cause The provided key length is not 16 (AES-128) or 32 (AES-256) bytes.
fix
Generate a key of appropriate length, e.g., key = b'abcdefghijklmnop' for AES-128 or 32 bytes for AES-256.
Warnings
breaking In v0.6.0, the default encryption algorithm changed from AES-128 to AES-256. Redacted data from earlier versions cannot be decrypted using the new default. ↓
fix Set the encryption algorithm explicitly when initializing: Redactor(algorithm='AES-128') to maintain backward compatibility.
gotcha The Redactor key must be exactly 32 bytes for AES-256 (or 16 bytes for AES-128). Passing a string of incorrect length raises a cryptic cryptography error. ↓
fix Ensure the key is exactly 32 bytes for default AES-256. Use key.encode('utf-8') or generate a proper key.
deprecated The method `redact_pii` is deprecated since v0.5.0. Use `redact` instead. ↓
fix Replace all calls to `redact_pii` with `redact`.
Imports
- Redactor wrong
from argus_redact import ArgusRedactorcorrectfrom argus_redact import Redactor
Quickstart
import os
from argus_redact import Redactor
# Initialize redactor with an encryption key
redactor = Redactor(key=os.environ.get('ARGUS_KEY', 'my-secret-key-32chars'))
# Redact PII in text
text = "My email is john.doe@example.com and phone is 555-1234."
redacted = redactor.redact(text)
print(redacted)
# Example output: "My email is <EMAIL> and phone is <PHONE>."