pyrate_limiter.utils module

pyrate_limiter.utils.dedicated_sqlite_clock_connection()
pyrate_limiter.utils.enforce_rate_list(rates)

Raise ValueError if rates are not a well-formed, ordered rate list.

A valid list is ordered by strictly increasing interval, with strictly increasing limits and non-increasing density (limit/interval) - i.e. the “generous-before-tight” contract. Pass rates already in the order the bucket will use them (sort first if the bucket sorts).

Return type:

None

pyrate_limiter.utils.id_generator(size=10)
Return type:

str

pyrate_limiter.utils.validate_rate_list(rates)

Raise false if rates are incorrectly ordered.

Return type:

bool