Warning: Bocadillo is now UNMAINTAINED. Users are recommended to migrate to a supported alternative, such as Starlette or FastAPI. Please see #344 for more information.

bocadillo.hooks

before

before(hook:Callable[[bocadillo.request.Request, bocadillo.response.Response, dict], Awaitable[NoneType]], *args, **kwargs)

Register a before hook on a handler.

Parameters

  • hook (callable): a hook function.

after

after(hook:Callable[[bocadillo.request.Request, bocadillo.response.Response, dict], Awaitable[NoneType]], *args, **kwargs)

Register an after hook on a handler.

Parameters

  • hook (callable): a hook function.