We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent be78941 commit 7e94ec4Copy full SHA for 7e94ec4
1 file changed
weather_fetcher.py
@@ -0,0 +1,15 @@
1
+import requests
2
+
3
+API_KEY = "your_api_key_here" # Замени на свой ключ
4
+CITY = "Kyiv"
5
+URL = f"https://api.openweathermap.org/data/2.5/weather?q={CITY}&appid={API_KEY}&units=metric"
6
7
+response = requests.get(URL)
8
+data = response.json()
9
10
+if response.status_code == 200:
11
+ temp = data['main']['temp']
12
+ weather = data['weather'][0]['description']
13
+ print(f"В {CITY} сейчас {temp}°C, {weather}")
14
+else:
15
+ print("Ошибка получения данных:", data)
0 commit comments