dictfilter
installation
pip install dictfilter
usage
from dictfilter import query
bsg = {
'class': 'Battlestar',
'model': 'Jupiter',
'name': 'Galactica',
'crew': {
'commander': 'William Adama',
'xo': 'Saul Tigh',
'cag': 'Kara Thrace',
}
}
result = query(bsg, ['class', 'name', 'crew.commander'])
# {
# 'class': 'Battlestar',
# 'name': 'Galactica',
# 'crew': {
# 'commander': 'William Adama',
# }
# }
The default delimiter used in field names is dot . however this can be changed
with the delimiter keyword argument to query:
result = query(bsg, ['class', 'name', 'crew > commander'], delimiter=' > ')
# {
# 'class': 'Battlestar',
# 'name': 'Galactica',
# 'crew': {
# 'commander': 'William Adama',
# }
# }
django integration
Register the dictfilter middleware in settings.py:
MIDDLEWARE = [
...
'dictfilter.django.middleware.DictFilterMiddleware',
]
By default, every 2xx series response will be filtered based on a
comma-separated fields parameter in the query string.
Metadata
Release files for dictfilter 2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dictfilter-2.1.tar.gz | 12.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dictfilter-2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.3 kB
Release files / dictfilter-2.1.tar.gz
| Download URL | dictfilter-2.1.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c2da06083dfae2f2dad1528ff5bc45d025b486088cd3714f748d3dc8fd502a7c
|
|
BLAKE2b-256 checksum How to use checksums |
3672b19e9df3b2d61a145f8af680e40efff020c50b79816ab69d499dba9a3548
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|
Release files / dictfilter-2.1-py3-none-any.whl
| Download URL | dictfilter-2.1-py3-none-any.whl |
|---|---|
| Size | 5.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9a35275dfe82755f489902947e0d202c1411009c44680d21fd4370a5bd87a837
|
|
BLAKE2b-256 checksum How to use checksums |
4d3e73f1db4c65432570f36e1c495e2bc1f2e55ab74013b74153ef6f0cb586fd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
|
Security for dictfilter 2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.