We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 13fb408 commit 3677988Copy full SHA for 3677988
Chauhan_Shyam_R/Task_5/weather_app.py
@@ -0,0 +1,19 @@
1
+import requests
2
+
3
+API_key = '01234567890'
4
5
+def get_weather(city):
6
+ url = f'http://api.openweathermap.org/data/2.5/weather?q={city}&appid={API_key}&units=metric'
7
+ res = requests.get(url).json()
8
+ return res
9
10
11
+def main():
12
+ city = input("Enter city name to fetch weather info. : ")
13
+ data = get_weather(city)
14
+ print(f"Weather in {city}")
15
+ print(f"Temperature: {data['main']['temp']} °C")
16
17
18
+if __name__ == '__main__':
19
+ main()
0 commit comments