mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-03 20:10:10 +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)
|
||||
num, period = rate.split('/')
|
||||
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)
|
||||
|
||||
def allow_request(self, request, view):
|
||||
|
|
Loading…
Reference in New Issue
Block a user