· 5 years ago · Sep 27, 2020, 01:42 PM
1#https://home.openweathermap.org/history_bulks/new
2
3from pyowm import OWM
4
5owm = OWM('cfd4f78d621328cc29093e078a80d280') # You MUST provide a valid API key
6mgr = owm.weather_manager()
7place =['London,GB',
8 'Sochi,RU',
9 'Moscow,Ru',
10 #'StPetersburg,RU',
11 'Paris,FR',
12 'Madrid',
13 'Valencia',
14 'Andorra',
15 'Yalta',
16 'Feodosia',
17 'Kushnytsya',
18 'Orsha,BY',
19 'Murino,Ru',
20 'Yaroslavl,Ru'
21
22 ]
23
24i=0
25while i<len(place):
26
27 observation = mgr.weather_at_place(place[i])
28 w = observation.weather
29 #print(w)
30 # Weather details
31 w.wind() # {'speed': 4.6, 'deg': 330}
32 w.humidity # 87
33 w.temperature('celsius') # {'temp_max': 10.5, 'temp': 9.7, 'temp_min': 9.0}
34 print(place[i])
35 print(w.wind(),w.humidity,w.temperature('celsius'))
36 i+=1
37