API¶
Core¶
- class djlimiter.Limiter¶
Bases: object
- process_request(request)¶
Parameters: request – Returns:
- process_response(request, response)¶
Parameters: - request –
- response –
Returns:
- djlimiter.limit(limit_value, key_function=None, per_method=False)¶
decorator to be used for rate limiting individual views
Parameters: - limit_value – rate limit string or a callable that returns a string. Rate limit string notation for more details.
- key_func (function) – function/lambda to extract the unique identifier for the rate limit. defaults to remote address of the request.
- per_method (bool) – whether the limit is sub categorized into the http method of the request.
- djlimiter.exempt(fn)¶
decorator to mark a view or all views in a blueprint as exempt from rate limits.
Parameters: fn – the view to wrap. Returns:
decorator to be applied to multiple views sharing the same rate limit.
Parameters: - limit_value – rate limit string or a callable that returns a string. Rate limit string notation for more details.
- scope – a string or callable that returns a string for defining the rate limiting scope.
- key_func (function) – function/lambda to extract the unique identifier for the rate limit. defaults to remote address of the request.