跳转到主要内容

Sopel天气模块的工作重实现

项目描述

version build issues alerts coverage-status license

简介

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 查看散列)

上传时间 源代码

构建分发

sopel_modules.weather-1.6.1-py3-none-any.whl (12.0 kB 查看散列)

上传时间 Python 3

由以下支持