-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathweatherChecking.py
36 lines (31 loc) · 1.08 KB
/
weatherChecking.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import requests
api_address="https://api.openweathermap.org/data/2.5/weather?appid=c87050bbe4837a49ada52f7197118520&q="
#taking input
print("Enter your city :")
city=raw_input()
#concating the url and city name
url=api_address+city
#sending the url through requests module
json_data=requests.get(url).json()
#gathering all reports
name=json_data['weather'][0]['main']
maxTemp=json_data['main']['temp_max']
minTemp=json_data['main']['temp_min']
currentTemp=json_data['main']['temp']
windSpeed=json_data['wind']['speed']
windDeg=json_data['wind']['deg']
des=json_data['weather'][0]['description']
hum=json_data['main']['humidity']
countryName=json_data['name']
clouds=json_data['clouds']['all']
#printing all report
print("Weather status is : ",name)
print("Description : ",des)
print("Humidity : ",hum)
print("Country : ",countryName)
print("Clouds density : ",clouds)
print("Current temperature is : ",currentTemp)
print("Maximum temperature : ",maxTemp)
print("Minimum temperature : ",minTemp)
print("Wind speed : ",windSpeed)
print("Wind degree : ",windDeg)