Rate Limiting

class sans.limiter.RateLimiter

Bases: Auth

httpx Auth utility object which implements ratelimiting, User-Agent management, and exponential backoff, while adding XML support to the resulting Response.

async async_auth_flow(request: Request) AsyncGenerator[Request, Response][source]

Execute the authentication flow asynchronously.

By default, this defers to .auth_flow(). You should override this method when the authentication scheme does I/O and/or uses concurrency primitives.

auth_flow(request: Request) Generator[Request, Response, None][source]

Execute the authentication flow.

To dispatch a request, yield it:

` yield request `

The client will .send() the response back into the flow generator. You can access it like so:

` response = yield request `

A return (or reaching the end of the generator) will result in the client returning the last response obtained from the server.

You can dispatch as many requests as is necessary.

sync_auth_flow(request: Request) Generator[Request, Response, None][source]

Execute the authentication flow synchronously.

By default, this defers to .auth_flow(). You should override this method when the authentication scheme does I/O and/or uses concurrency primitives.

class sans.limiter.TelegramLimiter(*, recruitment: bool)

Bases: RateLimiter