We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 68e7459 commit 020874aCopy full SHA for 020874a
1 file changed
API-With-Python
@@ -0,0 +1,11 @@
1
+//importing requests package to deal with http
2
+import requests
3
+city = input("Enter your city name: ")
4
+// To get API --> https://openweathermap.org/
5
+api_address = "http://api.openweathermap.org/data/2.5/weather?appid={ADD-YOUR-API-KEY}&q={}".format(city)
6
+//used get method to conect with the API
7
+// json method is used to convert JSON into python format JSON.
8
+json_data = requests.get(api_address).json()
9
+//indexing the weather and temp from the JSON
10
+output = json_data['weather'][0]['main'] 'and temperature is ' json_data['main']['temp']
11
+print("The weather is {} in {}.").format(output, city)
0 commit comments