falcon-filtering-hook
A small falcon hook to parse filtering elements from the request.
Usage
The easiest way to use this hook is the following:
class Resource:
filtering_fields = ("foo", "bar") # List of fields allowed for filtering
@falcon.before(FilteringHook())
def on_get(self, req, resp, user):
# Here req['context']['filters'] is set
The Hook will look in the query parameters for parameters looking like filter[key]=value.
It will create a filters dict into the request context accessible at req.context['filters'].
Inside this dict the key will be the one extracted from between the brackets.
i.e. key in the example above.
Configuration options
Allowing fields to be filtered
For security reasons, the fields allowed for filtering must be specified in the filtering_fields attribute of the resource.
All the fields not defined in it will be discarded by the hook.
Hook configuration
One parameter can be passed to the hook:
filtering_key : The base name of the key used for the filters. Default:
filter.
Example:
@falcon.before(PaginationFromRequestHook(
filtering_key='custom_filter',
))
def on_get(self, req, resp, user):
# Get request
Metadata
Release files for falcon-filtering 0.2.0
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 | Actions |
|---|---|---|---|---|
| falcon_filtering-0.2.0.tar.gz | 3.2 kB | Without provenance | Details for falcon_filtering-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| falcon_filtering-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for falcon_filtering-0.2.0-py3-none-any.whl |
Total release size: 7.3 kB
Release files / falcon_filtering-0.2.0.tar.gz
| Download URL | falcon_filtering-0.2.0.tar.gz |
|---|---|
| Size | 3.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b17e6c345da4a057ce22f5b77db96527133a7b271425f8daf527cc7aa0ec606
|
|
BLAKE2b-256 checksum How to use checksums |
26e0fa9bd83ca338ff80fb56a8f0c1aaca16c8710cf8a434ee4e5d90f9521f6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.7
|
Release files / falcon_filtering-0.2.0-py3-none-any.whl
| Download URL | falcon_filtering-0.2.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b7c130ef5b1b6fd883b5ed4148993c8e0cae816aa68a047acd6f6dbb28e89758
|
|
BLAKE2b-256 checksum How to use checksums |
65eb13cfacc421485de2f00aca0c2e35f8eaa9bddb44b8fd6b1ee81e0c04e49e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.5.0 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.6.7
|
Security for falcon-filtering 0.2.0
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.