Textforecast: API Reference#

class yr_weather.Textforecast(headers=None, use_cache=True)#

Bases: APIClient

A client for interacting with the Yr Textforecast API.

get_areas(area_type: Literal['land', 'sea', 'coast']) List[TextForecastArea]#

Get available areas and their polygons.

Parameters:

forecast (Literal["land", "sea", "coast"]) – One of the possible areas.

Returns:

A list of land, coast or sea areas, their polygons and names.

Return type:

list[TextForecastArea]

get_forecasts(forecast: Literal['landoverview', 'coast_en', 'coast_no', 'sea_en', 'sea_no', 'sea_wmo']) TextForecasts#

Get text forcasts for a selected area.

Parameters:

forecast (Literal["landoverview", "coast_en", "coast_no", "sea_en", "sea_no", "sea_wmo"]) – One of the possible forecast areas.

Returns:

A class with text forecasts for the selected area defined in the forecast parameter.

Return type:

TextForecasts

class yr_weather.data.textforecast.TextForecasts(data: APITextForecasts, forecast_type: str)#

A class storing text forecasts

now() TextForecastTime#

Get the TextForecastTime which applies now

Return type:

Optional[TextForecastTime]

class yr_weather.data.textforecast.TextForecastTime(from_time: str, to_time: str, locations: List[APIForecastArea])#

A class storing a specific text forecast time data

class yr_weather.data.textforecast.TextForecastLocations(locations: List[APIForecastArea])#

A class storing location data for a text forecast

get(location: str) ForecastLocation | None#

Get a specific location

Parameters:

location (str) – The location to search for

Returns:

The location which has been found, or None if not found.

Return type:

Optional[ForecastLocation]

property names: List[str]#

All location names occuring in this TextForecastLocations instance

Dataclasses#

class yr_weather.data.textforecast.ForecastLocation(name: str, id: str, text: str)#

A text forecast location

id: str#
name: str#
text: str#
class yr_weather.data.textforecast.TextForecastArea(id: str, name: str, polygon: str)#

A text forecast area from the /areas endpoint

id: str#
name: str#
polygon: str#