python - django limit the number of requests per minute -


i'm trying limit number of requests ip in case many requests it.

for example: if more 50 requests per minute want block ip 5 minutes.

when use request.meta['remote_addr'] ip of local host , not 1 sent request.

  1. how can ip of computer sent request?
  2. how can limit ip not send more requests x time?

django-ratelimite limit number of requests receive on given amount of time.

install:

pip install django-ratelimit 

in view:

from ratelimit.decorators import ratelimit  @ratelimit(key='ip', rate='10/m') def myview(request): ... 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -