Implements the Google Partial Response protocol in Python
Project description
Overview
Implements Google Partial Response / json-mask
in Python.
Requirements
- Python 2.7
- Python 3.6+
Installation
Install jsonmask with pip:
$ pip install jsonmask
or directly from the source code:
$ git clone https://github.com/zapier/jsonmask.git
$ cd jsonmask
$ python setup.py install
Usage
After installation, the package can imported:
$ python
>>> import jsonmask
>>> jsonmask.__version__
To prune dictionaries:
>>> import jsonmask
>>> mask = jsonmask.parse_fields('a,b(c,d)')
>>> jsonmask.apply_json_mask(
{
'a': {
'nested_within_a': True,
},
'b' {
'c': True,
'd': {'Will get included?': 'Yes'},
'e': 'Tough luck here',
},
'c': 'Definitely hopeless',
},
mask,
)
{
'a': {
'nested_within_a': True,
},
'b' {
'c': True,
'd': {'Will get included?': 'Yes'},
},
}
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
jsonmask-0.1.1.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for jsonmask-0.1.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0251c83f3530d21016dd50130e34cee17044f0b9da4a8ebef85197c9fff1ce67 |
|
MD5 | 9875553ba8bec6d466fb872dc16f89b9 |
|
BLAKE2b-256 | 99ef6b9f0ef4347d8a0365e7ba28092d8f5625c2e370e704c707be7160b91819 |