class documentation

class UserRateThrottle(SimpleRateThrottle): (source)

View In Hierarchy

Limits the rate of API calls that may be made by a given user. The user id will be used as a unique cache key if the user is authenticated. For anonymous requests, the IP address of the request will be used.

Method get_cache_key Should return a unique cache-key which can be used for throttling. Must be overridden.
Class Variable scope Undocumented

Inherited from SimpleRateThrottle:

Method __init__ Undocumented
Method allow_request Implement the check to see if the request should be throttled.
Method get_rate Determine the string representation of the allowed request rate.
Method parse_rate Given the request rate string, return a two tuple of: <allowed number of requests>, <period of time in seconds>
Method throttle_failure Called when a request to the API has failed due to throttling.
Method throttle_success Inserts the current request's timestamp along with the key into the cache.
Method wait Returns the recommended next request time in seconds.
Class Variable cache_format Undocumented
Instance Variable duration Undocumented
Instance Variable history Undocumented
Instance Variable key Undocumented
Instance Variable now Undocumented
Instance Variable num_requests Undocumented
Instance Variable rate Undocumented

Inherited from BaseThrottle (via SimpleRateThrottle):

Method get_ident Identify the machine making the request by parsing HTTP_X_FORWARDED_FOR if present and number of proxies is > 0. If not use all of HTTP_X_FORWARDED_FOR if it is available, if not use REMOTE_ADDR.
def get_cache_key(self, request, view): (source)

Should return a unique cache-key which can be used for throttling. Must be overridden. May return `None` if the request should not be throttled.