checkbox_sdk.client package

Subpackages

Submodules

checkbox_sdk.client.asynchronous module

checkbox_sdk.client.base module

checkbox_sdk.client.rate_limit module

class checkbox_sdk.client.rate_limit.AsyncRateLimitTransport(transport: AsyncBaseTransport, requests_per_10s: int | None = None)

Bases: AsyncBaseTransport

Transport wrapper to enforce rate limiting using requests per 10 seconds.

This class wraps an asynchronous HTTP transport to implement rate limiting, ensuring that no more than a specified number of requests are made within a 10-second window.

transport

The underlying asynchronous HTTP transport to handle requests.

Type:

httpx.AsyncBaseTransport

lock

A lock to ensure thread-safe request handling.

Type:

Lock

min_interval

The minimum time interval between requests, calculated from the rate limit.

Type:

float

last_request_time

The timestamp of the last request, used to track elapsed time.

Type:

float

async handle_async_request(request)

Handles the asynchronous request, enforcing the rate limit by ensuring the time between requests does not exceed the specified interval.

The method calculates the elapsed time since the last request and waits if necessary to maintain the rate limit before forwarding the request to the underlying transport.

Параметри:

request – The asynchronous HTTP request to be handled.

Повертає:

The response returned by the underlying transport after handling the request.

class checkbox_sdk.client.rate_limit.RateLimitTransport(transport: BaseTransport, requests_per_10s: int | None = None)

Bases: BaseTransport

Transport wrapper to enforce rate limiting using requests per 10 seconds.

This class wraps a synchronous HTTP transport to implement rate limiting, ensuring that no more than a specified number of requests are made within a 10-second window.

transport

The underlying HTTP transport to handle requests.

Type:

httpx.BaseTransport

lock

A lock to ensure thread-safe request handling.

Type:

Lock

min_interval

The minimum time interval between requests, calculated from the rate limit.

Type:

float

last_request_time

The timestamp of the last request, used to track elapsed time.

Type:

float

handle_request(request)

Handles the request, enforcing the rate limit by ensuring the time between requests does not exceed the specified interval.

The method calculates the elapsed time since the last request and waits if necessary to maintain the rate limit before forwarding the request to the underlying transport.

Параметри:

request – The HTTP request to be handled.

Повертає:

The response returned by the underlying transport after handling the request.

checkbox_sdk.client.synchronous module

Module contents