104 if resp.status_code == 404:
107 json_data = resp.json()
108 geoloc = weather.GeoLocation.by_query(resp.search_params[
"query"])
111 current=
_weather_data(geoloc, json_data[
"current_condition"][0]),
115 for day
in json_data[
"weather"]:
116 date = datetime.fromisoformat(day[
"date"])
117 time_slot_len = 24 // len(day[
"hourly"])
118 for index, forecast
in enumerate(day[
"hourly"]):
120 forecast_data.datetime =
weather.DateTime(date.replace(hour=index * time_slot_len + 1))
121 weather_answer.forecasts.append(forecast_data)
123 res.add(weather_answer)