Can I limit by special ip? #238
Unanswered
ormon-saadanbek
asked this question in
Q&A
Replies: 1 comment
-
Yes! You can do this with callable rates. The exact implementation depends on the details of what you’re looking for but you could do LIMIT_IPS = set([ip1, ip2, …])
def special_rate(group, request):
if request.META['REMOTE_ADDR'] in LIMIT_IPS:
return '5/h' # limit for these IPs
# for everyone else
return None # None for no limit, or 0 for no requests allowed, or another rate
@ratelimit(key='ip', rate=special_rate)
def my_view(request):
# …. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi there!
Can I limit user by special ip, cause I have a form where only 3-5 endless using it, I want to limit them.
How I can do it?
Beta Was this translation helpful? Give feedback.
All reactions