https://github.com/faylixe/flask-fool
A Flask extension that prevents browser access to application by faking browser error pages.
https://github.com/faylixe/flask-fool
flask flask-extensions python user-agent
Last synced: 3 months ago
JSON representation
A Flask extension that prevents browser access to application by faking browser error pages.
- Host: GitHub
- URL: https://github.com/faylixe/flask-fool
- Owner: Faylixe
- License: apache-2.0
- Created: 2018-02-13T09:00:48.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-02T18:25:18.000Z (over 8 years ago)
- Last Synced: 2025-09-03T08:20:03.314Z (9 months ago)
- Topics: flask, flask-extensions, python, user-agent
- Language: HTML
- Size: 89.8 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# flask-fool
[](https://pypi.python.org/pypi/Flask-Fool) [](https://circleci.com/gh/Faylixe/flask-fool)
A Flask extension that prevents browser access to API by faking browser error pages.
## Usage
```python
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 :
```python
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 :
```python
fooler = FlaskFool(app, user_agent='MyCustomUserAgent')
```