OpenWeatherAPI的一个调用、当前和预测5服务的迷你python包装器。
sunnyside的Python项目详细描述
日光浴
安装
pip3 install sunnyside
入门
Python版本
Sunnyside只支持python3.6+
^{pr2}$
当前天气
https://openweathermap.org/current
城市名称天气
Note:单位默认以开尔文为单位,将单位更改为英制或摄氏度。在
weather=ref.current_weather()response=weather.get_current_weather_by_city_name("city_name")# Enter your city name here
城市id的天气
response=weather.get_current_weather_by_city_id("city_id")
气象坐标
response=weather.get_current_weather_by_geo_coords("lat","lon")
邮政编码天气
response=weather.get_current_weather_by_zip_code("zipcode")
5天天气预报
https://openweathermap.org/forecast5
城市名称天气
forecast=ref.five_day_forecast()response=forecast.get_forecast_by_city_name("some_city_name_here")
城市id的天气
response=forecast.get_forecast_by_city_id("city_id")
气象坐标
response=forecast.get_forecast_by_geo_coords("lat","lon")
邮政编码天气
response=forecast.get_forecast_by_zip_code("zipcode")
一个电话
https://openweathermap.org/api/one-call-api
从一次调用api获取天气数据
openweather=ref.one_call()response=openweather.get_weather("33.441792","-94.037689")
参考文献
https://openweathermap.org/api
https://openweathermap.org/current
https://openweathermap.org/forecast5
https://openweathermap.org/api/one-call-api
- 项目
标签: