实时天气图片生成器
介绍
根据中国天气网生成天气信息,抓取最近四天内的天气以及实时数据, 附带一些农历日历信息。
效果预览
安装
pip install py-weathercn --user
使用
weathercn -f <自定义字体> <城市ID或城市名>
- 城市ID:如http://www.weather.com.cn/weather1d/101190401.shtml 中的101190401
- 将会在用户文件夹下生成.cache/weatherCN目录,为缓存weather.json, weather.png, icon.png文件
- weather.json为json文件
- weather.png为生成图片
- icon.png为当前天气的icon图标(例如用于waybar等)
- 自定义字体支持路径,fontconfig
json展示
{
"current": {
"humidity": "79%",
"wind_direction": "东南风 ",
"wind_level": "3级",
"air_quality": "29",
"air_pressure": "1004",
"updateat": "09:55",
"cur_weather": "阴",
"temperature": "23 ℃",
"weather": "小雨转阴",
"dcode": "d07",
"ncode": "d02",
"high": "25 ℃",
"low": "21 ℃",
"code": "d02",
"unsuited": "修坟-安葬-入宅-安门-安床",
"suited": "嫁娶-移徙-赴任-除服-纳采",
"lunar": "四月十三",
"shizhai": ""
},
"forcast": [
{
"date": "五月18日",
"weekday": "星期六",
"high": "25",
"low": "18",
"dcode": "d01",
"ncode": "n01",
"weather": "多云"
},
{
"date": "五月19日",
"weekday": "星期日",
"high": "27",
"low": "20",
"dcode": "d02",
"ncode": "n01",
"weather": "阴转多云"
},
{
"date": "五月20日",
"weekday": "星期一",
"high": "23",
"low": "16",
"dcode": "d01",
"ncode": "n00",
"weather": "多云转晴"
}
]
}
json释义
- humidity: 湿度
- wind_level: 风级
- wind_direction: 风向
- air_quality: 空气质量
- air_pressure: 气压
- updateat: 更新时间
- cur_weather: 当前天气
- temperature: 当前气温
- weather: 小雨转阴,
- dcode: 白天天气图标
- ncode: 夜间天气图标
- high: 最高温度
- low: 最低温度
- code: 当前天气图标
- unsuited: 不宜
- suited: 宜
- lunar: 农历
- shizhai: 是否是地藏十斋日
- date: 日期
Metadata
Release files for py-weathercn 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_weathercn-0.2.5.tar.gz | 152.0 kB | Without provenance | Details for py_weathercn-0.2.5.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_weathercn-0.2.5-py3-none-any.whl | Python 3 | none | any | Details for py_weathercn-0.2.5-py3-none-any.whl |
Total release size: 179.8 kB
Release files / py_weathercn-0.2.5.tar.gz
| Download URL | py_weathercn-0.2.5.tar.gz |
|---|---|
| Size | 152.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
39ab7cff0b53cfbcea8f83b126bf2e89a62771df247b2dbb560c9d58f1411987
|
|
BLAKE2b-256 checksum How to use checksums |
f85ebdda5353245ae3b60978c932f5bc12942267781b84c8625c351b22427402
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.12
|
Release files / py_weathercn-0.2.5-py3-none-any.whl
| Download URL | py_weathercn-0.2.5-py3-none-any.whl |
|---|---|
| Size | 27.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c7cb05633976c89fb145822682cb52a2e16a268842e5ee26689a3e64184b2570
|
|
BLAKE2b-256 checksum How to use checksums |
8225a80c7f591a0fea79503656d3712e6be0e26b6f7f374cb4cebc1039af2c14
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.7.12
|
Security for py-weathercn 0.2.5
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.