pi_portal.modules.integrations.network.http.HttpClient

class pi_portal.modules.integrations.network.http.HttpClient(log: Logger)[source]

Bases: object

Remote HTTP server client.

Parameters:

log (Logger) – A logging instance.

__init__(log: Logger) None[source]
get(url: str, target: str | None = None) Response[source]

Fetch a remote URL and save to a local file system target.

Parameters:
  • url (str) – The remote URL to fetch.

  • target (str | None) – The local path to write the content to.

Returns:

The http response object.

Return type:

Response

set_basic_auth(username: str, password: str) None[source]

Set basic authentication on the HTTP request.

Parameters:
  • username (str) – The username to use for authentication.

  • password (str) – The password to use for authentication.