Default Requestor

class moco_wrapper.util.requestor.DefaultRequestor(delay_ms: float = 1000.0)

Default Requestor class that is used by the moco_wrapper.Moco instance.

When the default requestor requests a resources and it sees the error code 429 (too many requests), it waits a bit and then tries the request again. If you do not want that behaviour, use moco_wrapper.util.requestor.NoRetryRequestor.

request(method: str, path: str, params: dict = None, data: dict = None, delay_ms: float = 0, **kwargs)

Request the given resource.

Parameters:
  • method (str) – HTTP Method (eg. POST, GET, PUT, DELETE)
  • path (str) – Path of the resource (e.g. /projects)
  • params (dict) – Url parameters (e.g. page=1, query parameters) (default None)
  • data (dict) – Dictionary with data (http body) (default None)
  • delay_ms (float) – Delay in milliseconds the requestor should wait before sending the request (used for retrying, default 0)
  • kwargs – Additional http arguments.
Returns:

Response object

session

Http Session this requestor uses