class documentation

class ScopedRateThrottle(SimpleRateThrottle): (source)

View In Hierarchy

Limits the rate of API calls by different amounts for various parts of the API. Any view that has the `throttle_scope` property set will be throttled. The unique cache key will be generated by concatenating the user id of the request, and the scope of the view being accessed.

Method __init__ Undocumented
Method allow_request Implement the check to see if the request should be throttled.
Method get_cache_key If `view.throttle_scope` is not set, don't apply this throttle.
Class Variable scope_attr Undocumented
Instance Variable duration Undocumented
Instance Variable num_requests Undocumented
Instance Variable rate Undocumented
Instance Variable scope Undocumented

Inherited from SimpleRateThrottle:

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 history Undocumented
Instance Variable key Undocumented
Instance Variable now 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 allow_request(self, request, view): (source)

Implement the check to see if the request should be throttled. On success calls `throttle_success`. On failure calls `throttle_failure`.

def get_cache_key(self, request, view): (source)

If `view.throttle_scope` is not set, don't apply this throttle. Otherwise generate the unique cache key by concatenating the user id with the `.throttle_scope` property of the view.

scope_attr: str = (source)

Undocumented