83def _weather_data(location: weather.GeoLocation, data: dict):
84
85
86 tempC: float = data.get("temp_C") or data.get("tempC")
87
88 return WeatherAnswer.Item(
89 location=location,
90 temperature=weather.Temperature(unit="°C", value=tempC),
91 condition=WWO_TO_CONDITION[data["weatherCode"]],
92 feels_like=weather.Temperature(unit="°C", value=data["FeelsLikeC"]),
93 wind_from=weather.Compass(int(data["winddirDegree"])),
94 wind_speed=weather.WindSpeed(data["windspeedKmph"], unit="km/h"),
95 pressure=weather.Pressure(data["pressure"], unit="hPa"),
96 humidity=weather.RelativeHumidity(data["humidity"]),
97 cloud_cover=data["cloudcover"],
98 )
99
100