Skip to main content

A Flask extension that prevents browser access to API.

Project description

pypi CircleCI

A Flask extension that prevents browser access to API by faking browser error pages.


from flask import flask
from flask_fool import FlaskFool

app = Flask('myapp')
fooler = FlaskFool(app)

From now if any error is caught by the application and the query has been emitted by a browser, an error page corresponding to the used browser will be returned, suggesting that the queried domain does not exist.

Disallow browser access

You can also totally prevent for browser access by using disallow_browser flag :

fooler = FlaskFool(app, disallow_browser=True)

User agent filtering

You can also just want your API only be reachable by a specific user agent. In that case you can specify a custom user agent for which only request will be received :

fooler = FlaskFool(app, user_agent='MyCustomUserAgent')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-Fool, version 1.0.9
Filename, size File type Python version Upload date Hashes
Filename, size flask-fool-1.0.9.tar.gz (67.3 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page