Skip to main content

Implements the Google Partial Response protocol in Python

Project description

Build Status Coverage Status PyPI Version

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


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 details)

Uploaded Source

Built Distribution

jsonmask-0.1.1-py2.py3-none-any.whl (15.6 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jsonmask-0.1.1.tar.gz.

File metadata

  • Download URL: jsonmask-0.1.1.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.5 CPython/3.7.1 Darwin/18.2.0

File hashes

Hashes for jsonmask-0.1.1.tar.gz
Algorithm Hash digest
SHA256 de73eeea74e1eed12ded1fe1dca729119d7640a4cb69b8e1e255da5e7cb6d268
MD5 5391aa3c1db744ca0b0909d4ef05ceee
BLAKE2b-256 a523d8a16e6c8e6cbbd78a428aa904563ca5441ae2659f669ad9345037798749

See more details on using hashes here.

File details

Details for the file jsonmask-0.1.1-py2.py3-none-any.whl.

File metadata

  • Download URL: jsonmask-0.1.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 15.6 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/0.12.5 CPython/3.7.1 Darwin/18.2.0

File hashes

Hashes for jsonmask-0.1.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0251c83f3530d21016dd50130e34cee17044f0b9da4a8ebef85197c9fff1ce67
MD5 9875553ba8bec6d466fb872dc16f89b9
BLAKE2b-256 99ef6b9f0ef4347d8a0365e7ba28092d8f5625c2e370e704c707be7160b91819

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page