Simple rates are of the form
X is a number of requests
u is a unit from this list:
(For example, you can read
5/s as “five per second.”)
You may also specify a number of units, i.e.:
Y is a
number of units. If
u is omitted, it is presumed to be seconds. So,
the following are equivalent, and all mean “one hundred requests per
New in version 0.5.
Rates can also be callables (or dotted paths to callables, which are
assumed if there is no
/ in the value).
Callables receive two values, the group and the
request object. They should return a simple rate string, or a tuple
(count, seconds). For example:
def my_rate(group, request): if request.user.is_authenticated: return '1000/m' return '100/m'
def my_rate_tuples(group, request): if request.user.is_authenticated: return (1000, 60) return (100, 60)
Callables can return
0 in the first place to disallow any requests
(0, 60)). They can return
None for “no