Skip to main content

Implements the Google Partial Response protocol in Python

Project description

Unix: Unix Build Status Windows: Windows Build Status
Metrics: Coverage Status Scrutinizer Code Quality
Usage: 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


Release history Release notifications

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
jsonmask-0.1.0-py2.py3-none-any.whl (14.8 kB) Copy SHA256 hash SHA256 Wheel py2.py3 Aug 27, 2018
jsonmask-0.1.0.tar.gz (5.4 kB) Copy SHA256 hash SHA256 Source None Aug 27, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page