Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/douganger/flask-ipfilter
A simple Flask extension to limit access to a site to certain IP addresses.
https://github.com/douganger/flask-ipfilter
flask heroku python3 security
Last synced: 24 days ago
JSON representation
A simple Flask extension to limit access to a site to certain IP addresses.
- Host: GitHub
- URL: https://github.com/douganger/flask-ipfilter
- Owner: douganger
- License: mit
- Created: 2019-03-05T23:53:32.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-15T21:20:16.000Z (over 1 year ago)
- Last Synced: 2024-10-01T10:23:19.636Z (about 1 month ago)
- Topics: flask, heroku, python3, security
- Language: Python
- Homepage: https://flask-ipfilter.readthedocs.io/
- Size: 97.7 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# Flask-IPFilter
[![Build Status](https://travis-ci.org/douganger/flask-ipfilter.svg?branch=master)](https://travis-ci.org/douganger/flask-ipfilter)
[![Coverage Status](https://coveralls.io/repos/github/douganger/flask-ipfilter/badge.svg?branch=master)](https://coveralls.io/github/douganger/flask-ipfilter?branch=master)
[![Documentation Status](https://readthedocs.org/projects/flask-ipfilter/badge/?version=latest)](https://flask-ipfilter.readthedocs.io/en/latest/?badge=latest)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/545d4bfe0bee4a47a7235b4f2205bae1)](https://www.codacy.com/gh/douganger/flask-ipfilter/dashboard)Flask-IPFilter is a simple Flask extension to limit access to a site to certain
IP addresses. The current implementation is a minimal proof of concept with one
important limitation:- The current implementation trusts the X-Forwarded-For header and uses the
last IP address in that header if multiple IP addresses are listed.## Quickstart
Install Flask-IPFilter with the command, `pip install flask-ipfilter`.
The following minimal Flask application demonstrates how to use Flask-IPFilter
in your application.```python
from flask import Flask
from flask_ipfilter import IPFilter, Whitelistapp = Flask(__name__)
ip_filter = IPFilter(app, ruleset=Whitelist())ip_filter.ruleset.permit("127.0.0.1")
@app.route("/")
def route_test():
return "Allowed."
```