MihailRus commited on
Commit
1afb7fd
·
verified ·
1 Parent(s): 363e1a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -76,8 +76,16 @@ def get_weather_by_city(city_name: str) -> str:
76
  weather_response = requests.get(weather_url)
77
  weather_response.raise_for_status()
78
  weather_data = weather_response.json()
79
- temperature = weather_data["current_weather"]["temperature"]
80
- return f"Текущая температура в {city_name}: {temperature}°C"
 
 
 
 
 
 
 
 
81
 
82
  except requests.RequestException as e:
83
  return f"Ошибка запроса погоды: {str(e)}"
 
76
  weather_response = requests.get(weather_url)
77
  weather_response.raise_for_status()
78
  weather_data = weather_response.json()
79
+
80
+ current = weather_data["current_weather"]
81
+ return (
82
+ f"Погода в {city_name}:\n"
83
+ f"• Температура: {current['temperature']}°C\n"
84
+ f"• Скорость ветра: {current['windspeed']} км/ч\n"
85
+ f"• Направление ветра: {current['winddirection']}°\n"
86
+ f"• Погодный код: {current['weathercode']}\n"
87
+ f"• Время измерения: {current['time'][-5:]}"
88
+ )
89
 
90
  except requests.RequestException as e:
91
  return f"Ошибка запроса погоды: {str(e)}"