Rate Limiter
The synchronous and asynchronous clients create a limiter from their
max_requests_per_second and rate_limit_* constructor arguments. Most
applications should configure the client instead of constructing this class
directly.
Request rate limiting for synchronous and asynchronous S7 clients.
- class snap7.rate_limiter.RequestRateLimiter(max_requests_per_second: float = 0, *, algorithm: ~typing.Literal['fixed', 'token_bucket'] = 'fixed', behavior: ~typing.Literal['block', 'raise'] = 'block', burst_capacity: int | None = None, _clock: ~collections.abc.Callable[[], float] = <built-in function monotonic>, _sleep: ~collections.abc.Callable[[float], None] = <built-in function sleep>)[source]
Per-client request rate limiter with thread-safe accounting.
fixedspaces requests evenly.token_bucketpermits bursts up toburst_capacityand then refills continuously at the configured rate. A rate of zero disables limiting. This lock protects only limiter state; it does not make the synchronous client safe for concurrent use.