flask.Flask.before_request

Flask.before_request(*args, **kwargs)[source]

Registers a function to run before each request.

The function will be called without any arguments. If the function returns a non-None value, it’s handled as if it was the return value from the view and further request handling is stopped.