雅虎天气新API Python Library
yahoo-weather的Python项目详细描述
Yahoo Weather的Python库(新API)
2019年1月3日,雅虎将其天气api更改为使用oauth1身份验证。这个新方法需要身份验证才能使用api。这个库帮助您处理新的api。 为了使用新的api,您必须从Yahoo!
from yahoo_weather.weather import YahooWeather
from yahoo_weather.config.units import Unit
data = YahooWeather(APP_ID="Your App ID",
api_key="Your API KEY",
api_secret="Your API secret")
data.get_yahoo_weather_by_city("tehran", Unit.celsius)
print(data.condition.text)
print(data.condition.temperature)
data.get_yahoo_weather_by_location(35.67194, 51.424438)
print(data.condition.text)
print(data.condition.temperature)