Base#

This module is used as a base for other classes and utilities.

class yr_weather.base.BaseClient(headers: dict, use_cache: bool | None = True)#

Bases: object

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