woob.capabilities.weather

class Forecast(date=NotLoaded, low=None, high=None, text=None, unit=None, url=None)[source]

Bases: BaseWeather

Weather forecast.

Variables:
  • url – (str) url

  • precipitation – (str) Precipitation type

  • precipitation_probability – (float) Probability of precipitation (ratio)

  • wind_direction – (str) Wind direction

  • wind_speed – (float) Wind speed (in km/h)

  • humidity – (float) Relative humidity (ratio)

  • pressure – (float) Atmospheric pressure (in hPa)

  • visibility – (float) Horizontal visibility distance (in km)

  • cloud – (int) Cloud coverage (in okta (0-8))

  • date – (datetime, date, str) Date for the forecast

  • low – (Temperature) Low temperature

  • high – (Temperature) High temperature

  • text – (str) Comment on forecast

class Current(date=NotLoaded, temp=None, text=None, unit=None, url=None)[source]

Bases: BaseWeather

Current weather.

Variables:
  • url – (str) url

  • precipitation – (str) Precipitation type

  • precipitation_probability – (float) Probability of precipitation (ratio)

  • wind_direction – (str) Wind direction

  • wind_speed – (float) Wind speed (in km/h)

  • humidity – (float) Relative humidity (ratio)

  • pressure – (float) Atmospheric pressure (in hPa)

  • visibility – (float) Horizontal visibility distance (in km)

  • cloud – (int) Cloud coverage (in okta (0-8))

  • date – (date, datetime) Date of measure

  • text – (str) Comment about current weather

  • temp – (Temperature) Current temperature

class City(id='', name=None, url=None)[source]

Bases: BaseObject

City where to find weather.

Variables:
  • url – (str) url

  • name – (str) Name of city

exception CityNotFound[source]

Bases: UserError

Raised when a city is not found.

class Temperature(value=NotLoaded, unit='', url=None)[source]

Bases: BaseObject

Variables:
  • url – (str) url

  • value – (float) Temperature value

  • unit – (str) Input unit

asfahrenheit()[source]
ascelsius()[source]
class CapWeather[source]

Bases: Capability

Capability for weather websites.

Look for a city.

Parameters:

pattern (str) – pattern to search

Return type:

iter[City]

get_current(city_id)[source]

Get current weather.

Parameters:

city_id – ID of the city

Return type:

Current

iter_forecast(city_id)[source]

Iter forecasts of a city.

Parameters:

city_id – ID of the city

Return type:

iter[Forecast]

class BaseWeather(id='', url=NotLoaded, backend=None)[source]

Bases: BaseObject

Variables:
  • url – (str) url

  • precipitation – (str) Precipitation type

  • precipitation_probability – (float) Probability of precipitation (ratio)

  • wind_direction – (str) Wind direction

  • wind_speed – (float) Wind speed (in km/h)

  • humidity – (float) Relative humidity (ratio)

  • pressure – (float) Atmospheric pressure (in hPa)

  • visibility – (float) Horizontal visibility distance (in km)

  • cloud – (int) Cloud coverage (in okta (0-8))

class Direction(*args, **kwargs)[source]

Bases: Enum

S = 'South'
N = 'North'
E = 'East'
W = 'West'
SE = 'Southeast'
SW = 'Southwest'
NW = 'Northwest'
NE = 'Northeast'
SSE = 'South-Southeast'
SSW = 'South-Southwest'
NNW = 'North-Northwest'
NNE = 'North-Northeast'
ESE = 'East-Southeast'
ENE = 'East-Northeast'
WSW = 'West-Southwest'
WNW = 'West-Northwest'
Variable = 'Variable'
class Precipitation(*args, **kwargs)[source]

Bases: Enum

RA = 'Rain'
SN = 'Snow'
GR = 'Hail'
PL = 'Ice pellets'
GS = 'Small hail'
DZ = 'Drizzle'
IC = 'Ice cristals'
SG = 'Small grains'
UP = 'Unknown precipiation'