If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!
# add this to your robots.txt:
#     User-agent: *
#     Disallow: /trap
# Make sure this URL is not linked from anywhere else. 
# Then when a user visits there you know they are ignoring your robots.txt.
# Add this snippet to your controller to block their IP.

BAN_IP_TIME = 60*60*24 
if cache.ram(request.client, lambda: False, BAN_IP_TIME):
    raise HTTP(503, 'IP blocked')   
def trap():                    
    cache.ram(request.client, None) 
    cache.ram(request.client, lambda: True, BAN_IP_TIME)


Related slices

Comments (0)

Hosting graciously provided by:
Python Anywhere