Falcon Query Parameter Verifier
A simple falcon hook to check if a request contains all required query parameters.
Installation / Requirements
Installation:
PyPi
pip install falcon-params-verifier
.whl
A .whl
is provided in the releases tab in Github.
Sample Usage
Sample code
import falcon
import falcon_params_verifier
from falcon_params_verifier import ParamVerifier # This can also be used.
class SampleResource(object):
# Add the hook
@falcon.before(falcon_params_verifier.ParamVerifier(['userId'])
def on_get(self, req, resp):
req.media = {
"message": "Whoo hoo, you made a proper request!"
}
If a query parameter is missing, the module will automatically raise an falcon.HTTPBadRequest
.