APIClient (base client)#

This module stores the API client which other modules depend on.

A module for API classes which other modules depend on.

class yr_weather.client.APIClient(headers: Dict[str, str] | None = None, use_cache: bool = True)#

Bases: object

A base API client other clients inherit.

set_headers(headers: dict) dict#

Set new headers of the client.

This will override any old headers, and replace them with the new headers from the headers parameter.

Parameters:

headers (dict) – The new headers, which will override the old ones.

Returns:

The headers which were set.

Return type:

dict

toggle_cache(toggle: bool) bool#

Toggle the usage of cache on or off.

Parameters:

toggle (bool) – Whether cache should be used, or whether to disable it.

Returns:

The new state of the cache (on/off).

Return type:

bool