Provides a simple middleware class that checks the client's IP address against the Http:BL database. IP addresses identified as threats will receive a HTTP 403 response.
- Add
httpbl
toINSTALLED_APPS
- Insert
httpbl.middleware.HttpBlMiddleware
intoMIDDLEWARE_CLASSES
, preferably at the top so that it runs before everything else. - Add a
HTTPBL_API_KEY
with your API key obtained from Project Honey Pot
HTTPBL_THREAT_SCORE
: the threat score at which to consider an IP a threat. Defaults to35
.HTTPBL_THREAT_AGE
: the maximum age in days at which to consider an IP a threat. Defaults to30
.HTTPBL_CACHE_LIFETIME
: cache lifetime for results, in seconds. Only applies if you have a working cache backend. Defaults to86400
(1 day).
Create a venv using requirements.txt
and run py.test
.