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.
- how can ip of computer sent request?
- 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
Post a Comment