-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweatherAPI.py
44 lines (31 loc) · 939 Bytes
/
weatherAPI.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
37
38
39
40
41
42
import pyowm
city1 = input("Enter the First City in " " with a comma: ")
country1=input ("Enter the First Country in " ": ")
name1=city1+country1
city2 = input("Enter the Second City in " " with a comma: ")
country2=input ("Enter the Second Country in " ": ")
name2=city2+country2
apiKey='3c9eaf32882bfec545d09bbaaf1e59e8'
owm = pyowm.OWM(apiKey)
observation = owm.weather_at_place (name1)
w = observation.get_weather()
a=w.get_wind ()
b=w.get_humidity ()
c=w.get_pressure ()
d=w.get_temperature()
print ('Data for', name1)
print ('The Wind: ', a)
print ('The Humidity: ', b)
print ('The Pressure: ' , c)
print ('The Temperature: ', d)
observation = owm.weather_at_place (name2)
w = observation.get_weather()
e=w.get_wind ()
f=w.get_humidity ()
g=w.get_pressure ()
h=w.get_temperature()
print ('Data for', name2)
print ('The Wind: ', e)
print ('The Humidity: ', f)
print ('The Pressure: ' , g)
print ('The Temperature: ', h)