With the increasing focus on type hints in Python, having a tool which automatically converted query params (with exception handling) would be a nice feature.
It's common for apps to have boilerplate code for converting request params, and returning 400-levels errors on failure.
@cherrypy.tools.params(exception=ValueError)defresource(self, limit: int):
assertisinstance(limit, int) # a ValueError would have already raised a 400
The text was updated successfully, but these errors were encountered:
With the increasing focus on type hints in Python, having a tool which automatically converted query params (with exception handling) would be a nice feature.
It's common for apps to have boilerplate code for converting request params, and returning 400-levels errors on failure.
The text was updated successfully, but these errors were encountered: