mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 12:30:11 +03:00
Update documentation
example won't work without importing random module
This commit is contained in:
parent
e7eccac6df
commit
564675e62f
|
@ -185,6 +185,7 @@ If the `.wait()` method is implemented and the request is throttled, then a `Ret
|
|||
The following is an example of a rate throttle, that will randomly throttle 1 in every 10 requests.
|
||||
|
||||
class RandomRateThrottle(throttling.BaseThrottle):
|
||||
import random
|
||||
def allow_request(self, request, view):
|
||||
return random.randint(1, 10) == 1
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user