API

NoFLoC

class flask_nofloc.NoFLoC(app=None)

The base extension class.

init_app(app)

Adds _add_nofloc_header() as an flask.Flask.after_request() hook to the app.

Parameters

app (flask.Flask) – A Flask app.

flask_nofloc.add_nofloc_header(view_function)

Adds the Permission-Policy header to a result from a view function.

This is supposed to be used as a decorator and should come after the flask.Flask.route() or flask.Blueprint.route() decorator:

@app.route('/nofloc')
@add_nofloc_header
def nofloc_route():
    return 'response'
Parameters

view_function (callable()) – A view function, see Blueprints and Views.

flask_nofloc._add_nofloc_header(response)

Adds the Permission-Policy header to a Response.

This is an internal function and is called by add_nofloc_header() and registered as an flask.Flask.after_request() hook in NoFLoC.init_app() .

The function adds the Permission-Policy header with a value of interest-cohort=() unless it is already present.

Parameters

response (flask.Response) – A response object.