Skip to main content

A package to hide/mask PII information in the JSON object.

Coverage Status License: MIT PyPI Code style: black

Installation and usage

Installation

The-mask requires Python 3.6+ and can be easily installed using the most common Python packaging tools.

We recommend installing the latest stable release from PyPI with pip:

$ pip install the-mask

Usage and documentation

the-mask is used to mask the PII or sensitive data in the JSON object with more flexible way.

from mask import mask
payload = {
    "name": "Jennifer",
    "email" "Jenn@abc.corp",
    "salary": "250000"
}
data_to_mask = {
    "name": "str", # It can also be `string`
    "email": "email",
    "salary": "znumber"
}
result = mask(payload, data_to_mask) # Option: 1
print(result)

# Result:
# {
#     "name": "J******r",
#     "email" "J**n@a**.corp",
#     "salary": "0"
# }


# Alternative Way: If the user wanted to modify the Payload itself
# Pass the inplace option as True
mask(payload, data_to_mask, inplace = True) # Option: 2
print(payload)

# Result:
# {
#     "name": "J******r",
#     "email" "J**n@a**.corp",
#     "salary": "0"
# }
How the Data to Mask param works?
Type of Data Example Dict Key Value Description
Plain Text values i.e., Name, Address etc., name str string or str can be passed to determine the value is a string
Email ID emailAddress email email is to mask the email id i.e., K***n@a**.corp
Numerical Values salary znumber znumber is used to convert the numerical value into 0 i.e., 250000 -> 0, 10000.90 -> 0.0, "1,135,000" -> "0"
Identity based Numerical Values id number number converts the value into random number with equivalent length.

License

MIT

Code of Conduct

Everyone participating in the-mask project, and in particular in the issue tracker, and pull requests is expected to treat other people with respect.


Give a ⭐️ if this project helped you!

Release files for the-mask 0.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 the-mask 0.0.1
File Size Uploaded
the-mask-0.0.1.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for the-mask 0.0.1
File Interpreter ABI Platform
the_mask-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / the-mask-0.0.1.tar.gz

Download URL the-mask-0.0.1.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
3fbb3e00841620086d891e98c21adb403527523111e96b2f4cd9bfd322470457
BLAKE2b-256 checksum
How to use checksums
e1b7f47f6ba2ebc66d82c6d7e59ea3efc3bbba7a1fc08d9f88151a1d251355a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release files / the_mask-0.0.1-py3-none-any.whl

Download URL the_mask-0.0.1-py3-none-any.whl
Size 7.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
dcfd2622d8d97c28dd0e2e2fd5d8012ae4946e191feacadcd133039aefef1fff
BLAKE2b-256 checksum
How to use checksums
6c3df56e099c2b03f83e860f01da0bc7afe0210d780b026ae85a4338ec7ebe25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.3

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

0.0.0

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