Skip to main content

DICT_FIELD_REDACTER

🇫🇷 Français

Description

DICT_FIELD_REDACTER est un outil Python permettant de masquer ou supprimer des champs sensibles dans des dictionnaires ou des objets JSON. Idéal pour anonymiser des données avant de les stocker ou de les partager.

Installation

pip install dict-field-redacter

Utilisation

test_data = {
    "user_profile": {
        "username": "john_doe",
        "email": "john@example.com",
        "personal_info": {
            "ssn": "123-45-6789",
            "password": "mySecretPass123",
            "banking": {
                "account_number": "ACC123456789",
                "secret": "bank_secret_key",
                "credit_card": {
                    "number": "4532-1234-5678-9012",
                    "cvv": "123",
                    "pin": "1234"
                }
            }
        }
    },
}
from dict_field_redacter import DictFieldRedacter
import json
fields_to_redact = ["email", "password", "secret", "cvv", "pin", "number"]
redacter = DictFieldRedacter(fields_to_redact, maskWith="Redacted") # Vous pouvez personnaliser le placeholder avec une valeur de votre choix
# La redaction en mode strict (seuls les champs spécifiés sont redacted, (ceux qui ne sont pas strictement dans la liste restent inchangés))
redacted = redacter.sanitize(test_data, mode="loose")
print(json.dumps(redacted, indent=4))
#{
#    "user_profile": {
#        "username": "john_doe",
#        "email": "Redacted",
#        "personal_info": {
#            "ssn": "123-45-6789",
#            "password": "Redacted",
#            "banking": {
#                "account_number": "Redacted",
#                "secret": "Redacted",
#                "credit_card": {
#                    "number": "4532-1234-5678-9012",
#                    "cvv": "123",
#                    "pin": "1234"
#                }
#            }
#        }
#    },
#}

Contribution

Les contributions sont les bienvenues ! Veuillez ouvrir une issue ou une pull request sur GitHub.

Licence

Ce projet est sous licence MIT.


🇬🇧 English

Description

DICT_FIELD_REDACTER is a Python tool that allows you to mask or remove sensitive fields in dictionaries or JSON objects. Ideal for anonymizing data before storing or sharing it.

Installation

pip install dict-field-redacter

Usage

test_data = {
    "user_profile": {
        "username": "john_doe",
        "email": "john@example.com",
        "personal_info": {
            "ssn": "123-45-6789",
            "password": "mySecretPass123",
            "banking": {
                "account_number": "ACC123456789",
                "secret": "bank_secret_key",
                "credit_card": {
                    "number": "4532-1234-5678-9012",
                    "cvv": "123",
                    "pin": "1234"
                }
            }
        }
    },
}
from dict_field_redacter import DictFieldRedacter
import json
fields_to_redact = ["email", "password", "secret", "cvv", "pin", "number"]
redacter = DictFieldRedacter(fields_to_redact, placeHolder="Redacted") # You can customize the placeholder
# 
redacted = redacter.sanitize(test_data, mode="loose")
print(json.dumps(redacted, indent=4))
#{
#    "user_profile": {
#        "username": "john_doe",
#        "email": "Redacted",
#        "personal_info": {
#            "ssn": "123-45-6789",
#            "password": "Redacted",
#            "banking": {
#                "account_number": "Redacted",
#                "secret": "Redacted",
#                "credit_card": {
#                    "number": "4532-1234-5678-9012",
#                    "cvv": "123",
#                    "pin": "1234"
#                }
#            }
#        }
#    },
#}

Contribution

Contributions are welcome! Please open an issue or a pull request on GitHub.

Licence

This project is licensed under the MIT License.

Metadata

Release files for dict-field-redacter 0.1.3

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

Source distribution (sdist)

Source distribution for dict-field-redacter 0.1.3
File Size Uploaded Provenance Actions
dict_field_redacter-0.1.3.tar.gz 6.1 kB Without provenance Details for dict_field_redacter-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dict-field-redacter 0.1.3
File Interpreter ABI Platform Actions
dict_field_redacter-0.1.3-py3-none-any.whl Python 3 none any Details for dict_field_redacter-0.1.3-py3-none-any.whl

Total release size: 13.2 kB

Release files / dict_field_redacter-0.1.3.tar.gz

Download URL dict_field_redacter-0.1.3.tar.gz
Size 6.1 kB
Tags Source
SHA-256 checksum
How to use checksums
10d80be8d896c8f85926d5c43a5cafc20cd6a9645e54bee3c73b7cc7bc713187
BLAKE2b-256 checksum
How to use checksums
8f75d6db1cf6fd101efc1ddba1eec03cdbcb3b4e30db5ebff0660502d0e0a2a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Release files / dict_field_redacter-0.1.3-py3-none-any.whl

Download URL dict_field_redacter-0.1.3-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f693da6f502577a4ef449a0632728e3f8ebd4d39df5f49e99952ac014645e5fb
BLAKE2b-256 checksum
How to use checksums
5dc3cb6607cdd40da99077b9e2d8bfe461418306492fe2d73c6de2784203a397
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.2

Security for dict-field-redacter 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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