Skip to content

Instantly share code, notes, and snippets.

@yeago
Created February 22, 2010 22:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yeago/311619 to your computer and use it in GitHub Desktop.
Save yeago/311619 to your computer and use it in GitHub Desktop.
middleware which serves suspicious IPs a message
class IPBot:
def process_request(self,request):
if request.META.get('REMOTE_ADDR') in getattr(settings,'SUSPECTED_BOTS',[]):
return HttpResponse("Hi. I'm not sure what you're doing, but if you'd like to continue doing it, please email me - stephen@mydomain.net")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment