ratelimiter¶
-
class
naz.ratelimiter.
BaseRateLimiter
[source]¶ Bases:
abc.ABC
This is the interface that must be implemented to satisfy naz’s rate limiting. User implementations should inherit this class and implement the
limit
methods with the type signatures shown.It may be important to control the rate at which the client(naz) sends requests to an SMSC/server. naz lets you do this, by allowing you to specify a custom rate limiter.
-
class
naz.ratelimiter.
SimpleRateLimiter
(send_rate=100000.0, logger=None)[source]¶ Bases:
naz.ratelimiter.BaseRateLimiter
This is an implementation of BaseRateLimiter.
It does rate limiting using a token bucket rate limiting algorithm
example usage:
rate_limiter = SimpleRateLimiter(send_rate=10) await rate_limiter.limit() send_messsages()