mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Added year option to throtting.
This commit is contained in:
parent
e8ec81f5e9
commit
2d22d09c88
|
@ -83,7 +83,7 @@ class SimpleRateThrottle(BaseThrottle):
|
||||||
return (None, None)
|
return (None, None)
|
||||||
num, period = rate.split('/')
|
num, period = rate.split('/')
|
||||||
num_requests = int(num)
|
num_requests = int(num)
|
||||||
duration = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400}[period[0]]
|
duration = {'s': 1, 'm': 60, 'h': 3600, 'd': 86400, 'y': 31536000}[period[0]]
|
||||||
return (num_requests, duration)
|
return (num_requests, duration)
|
||||||
|
|
||||||
def allow_request(self, request, view):
|
def allow_request(self, request, view):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user