Skip to content
This repository has been archived by the owner on Jun 3, 2024. It is now read-only.
/ Flask-NoFLoC Public archive

Adds Permissions-Policy: interest-cohort=() headers for Flask apps.

License

Notifications You must be signed in to change notification settings

shoeffner/Flask-NoFLoC

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flask-NoFLoC

Flask-NoFLoC is a Flask extension which disables FLoC by adding the header

Permissions-Policy: interest-cohort=()

to each HTTP response of your app. Documentation

Examples

To set it up, follow the usual Flask extension setup, either directly:

from flask import Flask
from flask_nofloc import NoFLoC

app = Flask(__name__)
NoFLoC(app)

or using the init_app-paradigm:

# extensions.py
from flask_noflock import NoFLoC

nofloc = NoFLoC()


# app.py
from flask import Flask
from extensions import nofloc

def create_app(settings):
    app = Flask('myapp')

    nofloc.init_app(app)

    return app

If you only want to exclude specific route, you can use a decorator:

from flask_nofloc import add_nofloc_header

@app.route('/nofloc')
@add_nofloc_header
def no_floc():
    return 'no FLoC'

Installation

Install via pip and your favorite installation method:

pip install Flask-NoFLoC

Background

For some background on FLoC, here is a list of related links:

Alternatives

Came here for Django? Check out django-nofloc.

About

Adds Permissions-Policy: interest-cohort=() headers for Flask apps.

Topics

Resources

License

Stars

Watchers

Forks