from pyowm import OWM
from pyowm.utils import config
from pyowm.utils import timestamps
from pyowm.utils.config import get_default_config
owm = OWM('3a6261216d2cd7d6ecb6aafe27b1fdb8') # You MUST provide a valid API key
config_dist = get_default_config()
config_dist['language'] = 'ru'
place = input('wrote a your city')
Search for current weather in London (Great Britain)
from pyowm import OWM from pyowm.utils import config from pyowm.utils import timestamps from pyowm.utils.config import get_default_config owm = OWM('3a6261216d2cd7d6ecb6aafe27b1fdb8') # You MUST provide a valid API key config_dist = get_default_config() config_dist['language'] = 'ru'
place = input('wrote a your city')
Search for current weather in London (Great Britain)
mgr = owm.weather_manager() observation = mgr.weather_at_place(place) w = observation.weather temp = w.temperature('celsius') ['temp'] tempmin = w.temperature('celsius')['temp_min'] tempmax = w.temperature('celsius')['temp_max'] cloud = w.detailed_status clouds = w.clouds wind = w.wind()['speed'] winds = w.wind()['deg'] daily_forecaster = mgr.forecast_at_place('Berlin,DE' 'daily') tomorrow = timestamps.tomorrow() # datetime object for tomorrow weather = daily_forecaster.get_weather_at(tomorrow)
print(w) print('Погода сейчас такая: ' + cloud + str(clouds)) print('Приблизна температура:' + str(temp)) print('Максимальна температура:' + str(tempmax)) print('Мінімальна температура:' + str(tempmin)) print('скорость ветра='+ str(wind)) print('угол ветра='+ str(winds)) if temp < 10: print('Одягай теплі вещі') elif temp < 20: print('Можна в худі') elif temp > 20: print('Літо, шорти') input('Щоб закрити програму нажміть Enter') print(weather)
the error line 21, in
daily_forecaster = mgr.forecast_at_place('Berlin,DE' 'daily')
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: WeatherManager.forecast_at_place() missing 1 required positional argument: 'interval'