weather.openweathermap

class platypush.plugins.weather.openweathermap.WeatherOpenweathermapPlugin(token: str, location: Optional[str] = None, city_id: Optional[int] = None, lat: Optional[float] = None, long: Optional[float] = None, zip_code: Optional[str] = None, units: str = 'metric', **kwargs)[source]

OpenWeatherMap plugin. This is the advised plugin to use for weather forecasts since Darksky has officially shut down their API.

You’ll need an API token from OpenWeatherMap in order to use this API.

__init__(token: str, location: Optional[str] = None, city_id: Optional[int] = None, lat: Optional[float] = None, long: Optional[float] = None, zip_code: Optional[str] = None, units: str = 'metric', **kwargs)[source]
Parameters
  • token – OpenWeatherMap API token.

  • location – If set, then this location will be used by default for weather lookup. If multiple locations share the same name you can disambiguate by specifying the country code as well - e.g. London,GB.

  • city_id – If set, then this city ID will be used by default for weather lookup. The full list of city IDs is available here.

  • lat – If lat/long are set, then the weather by default will be retrieved for the specified geo location.

  • long – If lat/long are set, then the weather by default will be retrieved for the specified geo location.

  • zip_code – If set, then this ZIP code (should be in the form zip,country_code) will be used by default for weather lookup.

  • units – Supported: metric (default), standard and imperial.

delete(url, **kwargs)

Perform a DELETE request

Parameters
download(url: str, path: str, **kwargs)

Locally download the content of a remote URL.

Parameters
  • url – URL to be downloaded.

  • path – Path where the content will be downloaded on the local filesystem - must be a file name.

get(url, **kwargs)[source]

Perform a GET request

Parameters
get_current_weather(*, location: Optional[str] = None, city_id: Optional[int] = None, lat: Optional[float] = None, long: Optional[float] = None, zip_code: Optional[str] = None, units: Optional[str] = None, **kwargs) dict[source]

Returns the current weather.

Parameters
  • location – Override the location configuration value.

  • city_id – Override the city_id configuration value.

  • lat – Override the lat configuration value.

  • long – Override the long configuration value.

  • zip_code – Override the zip_code configuration value.

  • units – Override the units configuration value.

head(url, **kwargs)

Perform an HTTP HEAD request

Parameters
options(url, **kwargs)

Perform an HTTP OPTIONS request

Parameters
post(url, **kwargs)

Perform a POST request

Parameters
put(url, **kwargs)

Perform a PUT request

Parameters