我目前正在尝试从OpenWeatherMap.org中提取天气预报。我可以获取当前时间的温度,但是稍后尝试获取温度时,这是不可能的。我有以下代码,但无法正常工作,有人知道如何使用PyOWN获得温度预测吗?
coordinateX = 1
coordinateY = 1
type = 'celsius'
obs = api.weather_at_coords(coordinateX, coordinateY)
# Get current weather
retrieve = obs.get_weather()
def temperature(type):
temperature = retrieve.get_temperature(type)
return temperature
# Get weather forecast
forecast3 = api.three_hours_forecast('London,uk')
f = forecast3.get_temperature(type)