leaf_engine.io.api.base_caller

Attributes

BACKOFF

DEFAULT_PAGE_SIZE

RETRIES

TIMEOUT

Classes

LeafBaseAPICaller

Abstract API caller class.

TimeoutHTTPAdapter

HTTPAdapter with configurable timeout on all request types.

Module Contents

class leaf_engine.io.api.base_caller.LeafBaseAPICaller(endpoint: str | None, key: str | None, backoff: int = BACKOFF, page_size: int = DEFAULT_PAGE_SIZE, retries: int = RETRIES, timeout: int = TIMEOUT)

Abstract API caller class.

Parameters:
  • endpoint (Optional[str]) –

  • key (Optional[str]) –

  • backoff (int) –

  • page_size (int) –

  • retries (int) –

  • timeout (int) –

endpoint
key
page_size
retry_config
session
timeout
class leaf_engine.io.api.base_caller.TimeoutHTTPAdapter(*args, **kwargs)

Bases: requests.adapters.HTTPAdapter

HTTPAdapter with configurable timeout on all request types.

send(*args, **kwargs)

Sends PreparedRequest object. Returns Response object.

Parameters:
  • request – The PreparedRequest being sent.

  • stream – (optional) Whether to stream the request content.

  • timeout (float or tuple or urllib3 Timeout object) – (optional) How long to wait for the server to send data before giving up, as a float, or a (connect timeout, read timeout) tuple.

  • verify – (optional) Either a boolean, in which case it controls whether we verify the server’s TLS certificate, or a string, in which case it must be a path to a CA bundle to use

  • cert – (optional) Any user-provided SSL certificate to be trusted.

  • proxies – (optional) The proxies dictionary to apply to the request.

Return type:

requests.Response

timeout: int
leaf_engine.io.api.base_caller.BACKOFF = 1
leaf_engine.io.api.base_caller.DEFAULT_PAGE_SIZE = 100
leaf_engine.io.api.base_caller.RETRIES = 3
leaf_engine.io.api.base_caller.TIMEOUT = 500