Skip to main content

Filter dictionaries based on a list of field names.

Project description



pip install dictfilter


bsg = {
    'class': 'Battlestar',
    'model': 'Jupiter',
    'name': 'Galactica',
    'crew': {
        'commander': 'William Adama',
        'xo': 'Saul Tigh',
        'cag': 'Kara Thrace',

result = query(some_data, ['class', 'name', 'crew.commander'])

# {
#     'class': 'Battlestar',
#     'name': 'Galactica',
#     'crew': {
#         'commander': 'William Adama',
#     }
# }

django integration

Register the dictfilter middleware in


By default, every 2xx series response will be filtered based on a comma-separated fields parameter in the query string.

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

dictfilter-2.0.0.tar.gz (12.3 kB view hashes)

Uploaded source

Built Distribution

dictfilter-2.0.0-py3-none-any.whl (3.4 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page