Rate Limit

Handle the rate limit option for a Controller.

exception rest_api_framework.ratelimit.TooManyRequest(description=None)[source]

Implement the 429 status code (see http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html for details)

class rest_api_framework.ratelimit.RateLimit(datastore, interval=6000, quota=100)[source]

Rate limit a user depending on the datetime of the request, the number of previous requests and the rate-limit strategy

check_limit(request)[source]

Implment the rate-limit method should first authenticate the user, then check his rate-limit quota based on the request. If request is not rate-limited, should increment the rate-limit counter.

Return None if the request is not rate-limited. raise HttpError with a 429 code otherwise