Sopel天气模块的工作重实现
项目描述
简介
sopel-weather是Sopel的天气查询插件。
由于Yahoo于2019年1月3日废弃了他们的天气API,因此需要重新实现天气插件
安装
如果可能,请使用
pip安装此插件。以下是一些示例命令;您可能需要根据您的系统和环境添加
sudo和/或调用不同的
pip(例如
pip3);请勿使用
setup.py install;Sopel无法正确加载插件。
已发布版本
pip install sopel-modules.weather
从源码
克隆存储库,然后在/path/to/sopel-weather中运行此命令
pip install .
配置
您可以使用
sopel configure –plugins命令自动配置此插件。
但是,如果您需要手动配置此插件,您需要在
~/.sopel/default.cfg中定义以下内容
[weather]
geocoords_provider = GEOCOORDS_PROVIDER
geocoords_api_key = GEOCOORDS_API_KEY
weather_provider = WEATHER_PROVIDER
weather_api_key = WEATHER_API_KEY
用法
当前天气
.weather # Only works if setlocation has been previously run
.weather seattle, us
.weather london
Paris, Ile-de-France, FR: 6°C (42°F), Clear, Humidity: 83%, UV Index: 0, Gentle breeze 4.0m/s (↗)
24小时预报
.forecast # Only works if setlocation has been previously run
.forecast seattle, us
.forecast london
Forecast: Paris, Ile-de-France, FR: Light rain tomorrow through next Saturday, High: 15°C (59°F), Low: 11°C (52°F), UV Index: 2
自定义用户位置
.setlocation london # Sets location by city name
.setlocation 98101 # Sets location by US zip code
I now have you at Paris, Ile-de-France, FR
要求
现代天气API需要经纬度作为API的输入,因此我们需要利用GeoCoords API将位置搜索转换为坐标。
API密钥
GeoCoords
LocationIQ
https://locationiq.com/
天气
Open-Meteo
不需要API密钥;使用您想要的任何字符串。
https://open-meteo.com/
OpenWeatherMap
https://openweathermap.org/
海盗天气
苹果收购的旧Dark Sky服务的替代API。
https://pirateweather.net/
Python需求
requests
sopel
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源代码分发
sopel_modules.weather-1.6.1.tar.gz (13.5 kB 查看散列)
构建分发
关闭
散列 for sopel_modules.weather-1.6.1-py3-none-any.whl
算法 | 散列摘要 | |
---|---|---|
SHA256 | ac33ceb092eb46340a5842ced6454a8fe60c7a769e2ef48bf2e984adeee69aec |
|
MD5 | 4af1837bac1dea4d4b4b5684490e8e36 |
|
BLAKE2b-256 | 74ebb8201b70567b19b1c3de13fbdd4129e653264249256e1892b3abec54b8f5 |