HTTP

async asyncpow.utils.http.request(session: ClientSession, url: URL, method: str = 'GET', request_timeout: int = 10, data: Any | None = None, json_data: dict[str, Any] | None = None, params: Mapping[str, str] | None = None, headers: dict | None = None) Any[source]

Make an HTTP request with backoff and retry logic.

Parameters:
  • session (ClientSession) – The aiohttp ClientSession to use for the request

  • url (URL) – The URL to sent the request to

  • method (str, optional) – The HTTP method to use fir the request. Defaults to hdrs.METH_GET.

  • request_timeout (int, optional) – Timeout for the request in seconds. Defaults to 10.

  • data (Any | None, optional) – data to include in the request. Defaults to None.

  • json_data (dict[str, Any] | None, optional) – JSON data to include in the request. Defaults to None.

  • params (Mapping[str, str] | None, optional) – parameters required for the request. Defaults to None.

  • headers (Optional[dict], optional) – headers required for the request. Defaults to None.

Raises:
  • POWTimeoutException – Request timeout error

  • POWConnectionException – Connection issue error

  • POWException – Generic exception

Returns:

Response in JSON or text

Return type:

Any