def public(endpoint):
    """A decorator for endpoints that flags them as publicly accessible
    The endpoint is the Flask endpoint function. This is later tested by the
    _is_public function, which is called before every request.
    Note that @public must come AFTER route.add i.e.
    @app.route('...')
    @public
    def handler(): ...
    """

@wraps(endpoint)
def public_endpoint(*args, **kwargs):
    return endpoint(*args, **kwargs)
public_endpoint._is_public = True
return public_endpoint
Создайте декоратор общедоступных URL-адресов Flask