Falcon filtering helper
Project description
A small falcon hook to parse filtering elements from the request.
Usage
The easiest way to use this hook is the following:
@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
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
falcon_filtering-0.0.1.tar.gz
(2.8 kB
view hashes)
Built Distribution
Close
Hashes for falcon_filtering-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 55e216f4c95f71bcda58541db1c516cd9fe6d6b853cee27e98d26d575314b390 |
|
MD5 | ee40a56a43698de112ca2add89f7fd7f |
|
BLAKE2b-256 | 70c85515b3d57468104a018eb3bc42a94de3648c18358b63528b581a74c3cbcb |