weatherwork-consumer-mcp 0.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of weatherwork-consumer-mcp might be problematic. Click here for more details.

Files changed (24) hide show
  1. weatherwork_consumer_mcp-0.3.1/.gitignore +10 -0
  2. weatherwork_consumer_mcp-0.3.1/PKG-INFO +149 -0
  3. weatherwork_consumer_mcp-0.3.1/README.md +128 -0
  4. weatherwork_consumer_mcp-0.3.1/SYSTEM_PROMPT.md +120 -0
  5. weatherwork_consumer_mcp-0.3.1/pyproject.toml +43 -0
  6. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/__init__.py +3 -0
  7. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/config.py +28 -0
  8. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/generate_url.py +629 -0
  9. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/server.py +140 -0
  10. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/__init__.py +1 -0
  11. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/_errors.py +53 -0
  12. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/_location.py +294 -0
  13. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/_utils.py +78 -0
  14. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/activity.py +415 -0
  15. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/air_quality.py +264 -0
  16. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/alerts.py +191 -0
  17. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/astronomy.py +210 -0
  18. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/current.py +316 -0
  19. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/forecast.py +342 -0
  20. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/hourly.py +291 -0
  21. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/minute_precip.py +462 -0
  22. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/resolve_location.py +199 -0
  23. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/tidal.py +208 -0
  24. weatherwork_consumer_mcp-0.3.1/src/weatherwork_consumer_mcp/tools/typhoon.py +145 -0
@@ -0,0 +1,10 @@
1
+ dist/
2
+ build/
3
+ *.egg-info/
4
+ .eggs/
5
+ __pycache__/
6
+ *.py[cod]
7
+ .venv/
8
+ venv/
9
+ .env
10
+ .env.local
@@ -0,0 +1,149 @@
1
+ Metadata-Version: 2.4
2
+ Name: weatherwork-consumer-mcp
3
+ Version: 0.3.1
4
+ Summary: WeatherWork Consumer MCP Server — 基于 weathercn API 的消费者天气工具集
5
+ Project-URL: Homepage, https://github.com/weatherwork/consumer-mcp
6
+ Project-URL: Repository, https://github.com/weatherwork/consumer-mcp
7
+ Project-URL: Documentation, https://github.com/weatherwork/consumer-mcp#readme
8
+ Author: WeatherWork
9
+ License: MIT
10
+ Keywords: forecast,mcp,model-context-protocol,weather,weathercn
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Topic :: Scientific/Engineering :: Atmospheric Science
18
+ Requires-Python: >=3.11
19
+ Requires-Dist: mcp>=1.0.0
20
+ Description-Content-Type: text/markdown
21
+
22
+ # WeatherWork Consumer MCP
23
+
24
+ 基于 [weathercn](https://platform.weathercn.com) API 的消费者天气 MCP 服务,提供 **17 个工具**(地名解析、实况、预报、预警、空气质量、分钟降水、生活指数、台风、天文、潮汐等)。
25
+
26
+ ## 安装
27
+
28
+ ```bash
29
+ pip install weatherwork-consumer-mcp
30
+ ```
31
+
32
+ 从本目录源码安装(开发):
33
+
34
+ ```bash
35
+ cd weatherwork-consumer-mcp
36
+ pip install -e .
37
+ ```
38
+
39
+ ## 配置密钥
40
+
41
+ **openAPI 标准模式**(推荐普通用户):
42
+
43
+ ```bash
44
+ export WEATHERCN_OPENAPI_KEY="your_openapi_key"
45
+ ```
46
+
47
+ **JV 高阶模式**(商务授权):
48
+
49
+ ```bash
50
+ export WEATHERCN_API_KEY="your_api_key"
51
+ export WEATHERCN_API_SECRET="your_api_secret"
52
+ ```
53
+
54
+ > 设置了 `WEATHERCN_OPENAPI_KEY` 时优先走 openAPI;未设置则使用 JV 凭证。详见 `.env.example`。
55
+
56
+ ## 运行
57
+
58
+ 安装后可直接启动 MCP(stdio):
59
+
60
+ ```bash
61
+ weatherwork-consumer-mcp
62
+ ```
63
+
64
+ ## 接入 Claude Desktop
65
+
66
+ 编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "weatherwork": {
72
+ "command": "weatherwork-consumer-mcp",
73
+ "env": {
74
+ "WEATHERCN_OPENAPI_KEY": "your_openapi_key"
75
+ }
76
+ }
77
+ }
78
+ }
79
+ ```
80
+
81
+ ## 接入 Cursor
82
+
83
+ `.cursor/mcp.json` 示例:
84
+
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "weatherwork": {
89
+ "command": "weatherwork-consumer-mcp",
90
+ "env": {
91
+ "WEATHERCN_OPENAPI_KEY": "your_openapi_key"
92
+ }
93
+ }
94
+ }
95
+ }
96
+ ```
97
+
98
+ ## 工具列表
99
+
100
+ | 工具 | 说明 |
101
+ |------|------|
102
+ | `resolve_location` | 地名解析与消歧义 |
103
+ | `get_weather_alerts` | 气象预警(透传,勿解读) |
104
+ | `get_current_weather` | 当前实况 |
105
+ | `get_weather_forecast` | 逐日预报 |
106
+ | `get_hourly_forecast` | 逐小时预报 |
107
+ | `get_activity_advice` | 生活指数与活动建议 |
108
+ | `get_air_quality` | 空气质量 |
109
+ | `get_minute_precipitation` | 分钟级降水(GCJ-02 坐标) |
110
+ | `get_typhoon_*` | 台风(JV) |
111
+ | `get_astronomy_*` | 天文(JV) |
112
+ | `get_tidal_*` | 潮汐(JV) |
113
+
114
+ ## 本地测试
115
+
116
+ ```bash
117
+ pip install -e .
118
+ export WEATHERCN_OPENAPI_KEY="..."
119
+ python tests/test_tools.py
120
+ ```
121
+
122
+ ## 发布到 PyPI(维护者)
123
+
124
+ ```bash
125
+ pip install build twine
126
+ python -m build
127
+ twine upload dist/*
128
+ ```
129
+
130
+ ## 目录结构
131
+
132
+ ```
133
+ weatherwork-consumer-mcp/
134
+ ├── pyproject.toml
135
+ ├── README.md
136
+ ├── .env.example
137
+ ├── SYSTEM_PROMPT.md
138
+ ├── tests/test_tools.py
139
+ └── src/weatherwork_consumer_mcp/
140
+ ├── server.py # MCP 入口
141
+ ├── config.py
142
+ ├── generate_url.py
143
+ └── tools/ # 17 个工具实现
144
+ ```
145
+
146
+ ## 环境要求
147
+
148
+ - Python 3.11+
149
+ - 依赖:`mcp>=1.0.0`
@@ -0,0 +1,128 @@
1
+ # WeatherWork Consumer MCP
2
+
3
+ 基于 [weathercn](https://platform.weathercn.com) API 的消费者天气 MCP 服务,提供 **17 个工具**(地名解析、实况、预报、预警、空气质量、分钟降水、生活指数、台风、天文、潮汐等)。
4
+
5
+ ## 安装
6
+
7
+ ```bash
8
+ pip install weatherwork-consumer-mcp
9
+ ```
10
+
11
+ 从本目录源码安装(开发):
12
+
13
+ ```bash
14
+ cd weatherwork-consumer-mcp
15
+ pip install -e .
16
+ ```
17
+
18
+ ## 配置密钥
19
+
20
+ **openAPI 标准模式**(推荐普通用户):
21
+
22
+ ```bash
23
+ export WEATHERCN_OPENAPI_KEY="your_openapi_key"
24
+ ```
25
+
26
+ **JV 高阶模式**(商务授权):
27
+
28
+ ```bash
29
+ export WEATHERCN_API_KEY="your_api_key"
30
+ export WEATHERCN_API_SECRET="your_api_secret"
31
+ ```
32
+
33
+ > 设置了 `WEATHERCN_OPENAPI_KEY` 时优先走 openAPI;未设置则使用 JV 凭证。详见 `.env.example`。
34
+
35
+ ## 运行
36
+
37
+ 安装后可直接启动 MCP(stdio):
38
+
39
+ ```bash
40
+ weatherwork-consumer-mcp
41
+ ```
42
+
43
+ ## 接入 Claude Desktop
44
+
45
+ 编辑 `~/Library/Application Support/Claude/claude_desktop_config.json`:
46
+
47
+ ```json
48
+ {
49
+ "mcpServers": {
50
+ "weatherwork": {
51
+ "command": "weatherwork-consumer-mcp",
52
+ "env": {
53
+ "WEATHERCN_OPENAPI_KEY": "your_openapi_key"
54
+ }
55
+ }
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## 接入 Cursor
61
+
62
+ `.cursor/mcp.json` 示例:
63
+
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "weatherwork": {
68
+ "command": "weatherwork-consumer-mcp",
69
+ "env": {
70
+ "WEATHERCN_OPENAPI_KEY": "your_openapi_key"
71
+ }
72
+ }
73
+ }
74
+ }
75
+ ```
76
+
77
+ ## 工具列表
78
+
79
+ | 工具 | 说明 |
80
+ |------|------|
81
+ | `resolve_location` | 地名解析与消歧义 |
82
+ | `get_weather_alerts` | 气象预警(透传,勿解读) |
83
+ | `get_current_weather` | 当前实况 |
84
+ | `get_weather_forecast` | 逐日预报 |
85
+ | `get_hourly_forecast` | 逐小时预报 |
86
+ | `get_activity_advice` | 生活指数与活动建议 |
87
+ | `get_air_quality` | 空气质量 |
88
+ | `get_minute_precipitation` | 分钟级降水(GCJ-02 坐标) |
89
+ | `get_typhoon_*` | 台风(JV) |
90
+ | `get_astronomy_*` | 天文(JV) |
91
+ | `get_tidal_*` | 潮汐(JV) |
92
+
93
+ ## 本地测试
94
+
95
+ ```bash
96
+ pip install -e .
97
+ export WEATHERCN_OPENAPI_KEY="..."
98
+ python tests/test_tools.py
99
+ ```
100
+
101
+ ## 发布到 PyPI(维护者)
102
+
103
+ ```bash
104
+ pip install build twine
105
+ python -m build
106
+ twine upload dist/*
107
+ ```
108
+
109
+ ## 目录结构
110
+
111
+ ```
112
+ weatherwork-consumer-mcp/
113
+ ├── pyproject.toml
114
+ ├── README.md
115
+ ├── .env.example
116
+ ├── SYSTEM_PROMPT.md
117
+ ├── tests/test_tools.py
118
+ └── src/weatherwork_consumer_mcp/
119
+ ├── server.py # MCP 入口
120
+ ├── config.py
121
+ ├── generate_url.py
122
+ └── tools/ # 17 个工具实现
123
+ ```
124
+
125
+ ## 环境要求
126
+
127
+ - Python 3.11+
128
+ - 依赖:`mcp>=1.0.0`
@@ -0,0 +1,120 @@
1
+ # WeatherWork Consumer MCP — 系统提示词
2
+
3
+ 将以下内容粘贴到 AI 客户端的系统提示框(System Prompt)中,以获得最佳天气查询体验。
4
+
5
+ ---
6
+
7
+ ```
8
+ 你是专业天气助手,通过 WeatherWork MCP 工具获取天气数据。严格遵守以下规则,不得推测或捏造天气信息。
9
+
10
+ ## 工具路由规则
11
+
12
+ 1. 用户提到「预警/气象灾害/暴雨/寒潮/大风」等、且指**本地气象预警** → 优先调用 get_weather_alerts
13
+ 2. 用户问「现在/当前天气/多少度」 → 调用 get_current_weather(支持城市名或坐标)
14
+ 3. 用户问「今天下午/今晚/未来几小时」 → 调用 get_hourly_forecast
15
+ 4. 用户问「2小时内/马上/出门会不会淋雨/需不需要带伞」 → 调用 get_minute_precipitation(需传坐标;无坐标时先用 get_current_weather 的 geo 或 resolve_location)
16
+ 5. 用户问「明天/周末/后天/未来几天」 → 调用 get_weather_forecast
17
+ 6. 用户问「AQI/空气质量/PM2.5/雾霾」 → 调用 get_air_quality
18
+ 7. 用户问「穿衣/洗车/运动/出行/带伞指数」 → 调用 get_activity_advice
19
+ 8. 用户给出坐标(如「39.9,116.4」)且问**一般天气**(非分钟降水) → 调用 get_current_weather,传坐标字符串
20
+ 9. 用户问「日出/日落/月相/天文」→ 调用 get_astronomy_daily(优先读返回中的 summary;无则需 JV 密钥)
21
+ 10. 用户问「潮汐/涨潮退潮」→ 沿海地点调用 get_tidal_5day_forecast 或 get_tidal_hourly_forecast / get_tidal_station(需 JV)
22
+ 11. 用户问「台风编号详情/路径」→ 已知编号时调用 get_typhoon_detail;问「今年有哪些台风」→ get_typhoon_season_list(year);问「最近台风」→ get_typhoon_recent
23
+ 12. 「台风」一词区分:**中央气象台对本地的台风预警**仍走 get_weather_alerts;**台风路径与命名台风列表**走第 11 条台风专用工具(二者可同时需要时不要混淆)
24
+
25
+ ## 参数规则
26
+
27
+ - get_weather_forecast.days:用户要1天传1,要2-5天传5,要6-10天传10,超出10天告知不支持
28
+ - get_hourly_forecast.hours:用户要1-12小时传12,要13-24小时传24,超出24小时告知普通账户限制
29
+ - location 字段:城市名(如「北京」)或坐标字符串(如「39.9,116.4」)均可直接传入,工具内部自动解析
30
+ - 用户说英语时传 language=en-us,否则传 zh-cn
31
+ - JV 专属工具(天文/潮汐/台风路径):需环境变量 WEATHERCN_API_KEY + WEATHERCN_API_SECRET;若仅有 OPENAPI_KEY,相关工具会返回友好错误,勿捏造数据
32
+
33
+ ## 工具返回结构(必读)
34
+
35
+ - 每条工具响应 JSON 均含 **source** 字段,值为 **中国天气/华风爱科**;向用户口述天气结论时,可在文末简短注明数据来源(与 source 一致即可)
36
+ - 成功:各工具返回字段不同。**get_astronomy_daily** 优先使用 **summary**(日出日落等摘要),完整原始在 **data**
37
+ - 失败:统一为 **{"error": "中文说明"}**,已为终端用户可读文案,**禁止向用户复读 HTTP 状态码**(工具侧已不再暴露)
38
+ - **台风/潮汐** 成功时常为 **{"data": ...}**;与其它天气工具字段并存时按字段语义选用
39
+
40
+ ## 地点处理规则
41
+
42
+ - 若地点可能重名(如「朝阳」、「长安」、「西湖」),先澄清省市区,再调用工具
43
+ - 若工具返回 needs_disambiguation=true(或 resolve_location 返回多条候选),将 candidates 列表展示给用户选择
44
+ - 若用户输入 POI(如「XX大厦」、「某某广场」),提示无法识别具体建筑,建议改用城市或区县名
45
+ - 若用户未提供地点,先追问,不要调用工具
46
+
47
+ ## 缺地点追问规则(上下文记忆)
48
+
49
+ - 追问地点后,用户下一轮只补充了地点(如「北京」),应接续上一轮意图继续回答,不要重新追问
50
+ - 若上下文超过3轮或意图明显切换,重新走完整意图识别
51
+
52
+ ## 多地点规则
53
+
54
+ - 最多同时处理2个地点,超过2个只取前两个并提示「建议单次查询一个地点」
55
+ - 若包含「对比/比较」语义,横向对齐两地温度与降水后输出
56
+
57
+ ## 输出规范
58
+
59
+ **结构**:结论(能/不能/带伞)→ 核心支撑数据(降水/温度)→ 暖心贴士
60
+
61
+ **优先级**:预警 > 分钟降水 > 逐小时 > 逐日/指数
62
+
63
+ **预警输出**:
64
+ - 有预警时第一句必须播报,格式:【预警类型 颜色图标 级别】+ 结论
65
+ - 颜色图标:红色 🔴 橙色 🟠 黄色 🟡 蓝色 🔵
66
+ - 示例:【暴雨 🟠 橙色预警】今天不建议安排户外出行。
67
+
68
+ **单位统一**:
69
+ - 温度:°C(如 29°C)
70
+ - 风速:km/h
71
+ - 降水:% 概率
72
+
73
+ **风力等级(强制)**:
74
+ - 必须使用接口里的 `wind_force_level`、`wind_gust_force_level`(0–12),但对用户**只说中文**:如「风力 3 级」「阵风 6 级」,**禁止**照抄 `wind_force_level` 等英文字段名
75
+ - **禁止**把 `wind_level` 接口文案(如「5–6 级」「微风」)与数值等级**放在同一句里并列**;对外风力**只采用数值等级这一套**,避免两套说法互相矛盾
76
+ - **篇幅**:风况尽量**一句写完**——示例:「西北风,约 19 km/h,风力 3 级」。仅当阵风**等级高于平均**,或阵风**风速明显高于平均**时,再简短补一句阵风;若阵风与平均**同级且风速接近**,**不写阵风**,避免同信息说两遍
77
+
78
+ **分钟降水输出**:
79
+ - 优先给「最近连续20分钟无雨窗口」,而不只是「现在下不下雨」
80
+ - 若有窗口,给出具体时间段(如「16:10-16:45 可出门」)
81
+ - 若无窗口,明确说「暂无合适窗口,建议室内等待」
82
+ - 雨势增强时追加:「雨势正在增强,建议加快脚步」
83
+ - 雨势即将减弱时追加:「再等 N 分钟,雨就变小了」
84
+
85
+ **Emoji 使用**(每条回复 1–3 个,预警图标必须保留):
86
+ - 晴好 ☀️ 多云 ⛅ 阵雨 🌦️ 小雨 ☔ 大雨/暴雨 ⛈️
87
+ - 雷电 ⚡ 大风 🌬️ 高温 🔥 寒冷 🥶 空气差 😷
88
+ - 可执行建议 ✅ 不建议 ❌
89
+
90
+ **冲突仲裁**:
91
+ - hourly 显示无雨但存在预警 → 以预警为准,首句播报预警
92
+ - 分钟降水与逐小时冲突 → 以分钟降水为准,逐小时仅作趋势补充说明
93
+ - 多源数据冲突 → 严格按 alerts > minute > hourly > current/index 仲裁
94
+
95
+ **数据时效**:
96
+ - 若 get_current_weather 返回的 obs_time 距当前超过60分钟,输出时必须标注「截至 XX:XX」
97
+ - 若 get_minute_precipitation 返回 radar_delayed=true,改为:「实时雷达数据正在校准中,建议参考逐小时预报」
98
+
99
+ **分钟降水倒计时表达**(优先使用确定性语气):
100
+ - ✅ 「还有 12 分钟雨就要停了,预计持续到 15:45」
101
+ - ✅ 「建议 16:10 再出发,那时路面积水也会少一些」
102
+ - ❌ 避免只说「未来一小时有雨」这类低确定性表达
103
+
104
+ ## 边界与拦截规则
105
+
106
+ **超出范围的问题**(不调用任何工具,友好引导):
107
+ - 历史天气(超过昨日):说明暂不支持,建议查询近期天气
108
+ - 超出10天的预报:说明暂不支持,建议查询10天内
109
+ - 地震、海啸等非气象灾害:说明超出范围,引导至气象相关问题
110
+ - 算命、美食、旅游攻略等完全无关问题:不硬拒绝,用「我不擅长X,但可以帮你查Y(天气相关)」引导
111
+ - 示例:「我专注于天气查询,但如果您打算户外聚餐,我可以帮您看今天哪段时间最凉爽、是否需要避雨。」
112
+
113
+ **错误处理**:
114
+ - 工具返回 **error** 字段时,用**自然语言转述**该提示给用户,不要追加 HTTP 码或英文异常(工具已脱敏)
115
+ - API 500/502:若工具未区分,统一转述为「服务暂时不稳定,请稍后再试」
116
+ - 鉴权/配置问题:转述为「请检查天气服务配置或联系管理员」
117
+ - 网络问题:转述为「网络异常,请稍后重试」
118
+ - 坐标越界(如999,999):返回「经纬度参数异常,纬度范围 -90~90,经度范围 -180~180」
119
+ - 出错时不输出推测结论
120
+ ```
@@ -0,0 +1,43 @@
1
+ [build-system]
2
+ requires = ["hatchling"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "weatherwork-consumer-mcp"
7
+ version = "0.3.1"
8
+ description = "WeatherWork Consumer MCP Server — 基于 weathercn API 的消费者天气工具集"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = { text = "MIT" }
12
+ authors = [{ name = "WeatherWork" }]
13
+ keywords = ["weather", "mcp", "weathercn", "forecast", "model-context-protocol"]
14
+ classifiers = [
15
+ "Development Status :: 4 - Beta",
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Programming Language :: Python :: 3",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Topic :: Scientific/Engineering :: Atmospheric Science",
22
+ ]
23
+ dependencies = [
24
+ "mcp>=1.0.0",
25
+ ]
26
+
27
+ [project.scripts]
28
+ weatherwork-consumer-mcp = "weatherwork_consumer_mcp.server:main_sync"
29
+
30
+ [project.urls]
31
+ Homepage = "https://github.com/weatherwork/consumer-mcp"
32
+ Repository = "https://github.com/weatherwork/consumer-mcp"
33
+ Documentation = "https://github.com/weatherwork/consumer-mcp#readme"
34
+
35
+ [tool.hatch.build.targets.wheel]
36
+ packages = ["src/weatherwork_consumer_mcp"]
37
+
38
+ [tool.hatch.build.targets.sdist]
39
+ include = [
40
+ "/README.md",
41
+ "/SYSTEM_PROMPT.md",
42
+ "/src/weatherwork_consumer_mcp",
43
+ ]
@@ -0,0 +1,3 @@
1
+ """WeatherWork Consumer MCP — 基于 weathercn API 的天气 MCP 服务。"""
2
+
3
+ __version__ = "0.3.1"
@@ -0,0 +1,28 @@
1
+ class DefaultConfig:
2
+
3
+ """
4
+ 通过环境变量注入密钥,避免将敏感信息写入代码仓库。
5
+
6
+ JV 接口(高阶用户):
7
+ - WEATHERCN_API_KEY 必需
8
+ - WEATHERCN_API_SECRET 必需
9
+ - WEATHERCN_DOMAIN 可选,默认 api.weathercn.com
10
+ - WEATHERCN_PROTOCOL 可选,默认 https
11
+
12
+ openAPI 接口(普通用户,仅需 apikey):
13
+ - WEATHERCN_OPENAPI_KEY 必需(openapi.weathercn.com 的 apikey)
14
+ - WEATHERCN_OPENAPI_DOMAIN 可选,默认 openapi.weathercn.com
15
+ """
16
+
17
+ import os as _os
18
+
19
+ # JV 接口
20
+ APIKEY = _os.getenv("WEATHERCN_API_KEY", "")
21
+ APISECRET = _os.getenv("WEATHERCN_API_SECRET", "")
22
+ DOMAIN = _os.getenv("WEATHERCN_DOMAIN", "api.weathercn.com")
23
+ PROTOCAL = _os.getenv("WEATHERCN_PROTOCOL", "https")
24
+
25
+ # openAPI 接口
26
+ OPENAPI_KEY = _os.getenv("WEATHERCN_OPENAPI_KEY", "")
27
+ OPENAPI_DOMAIN = _os.getenv("WEATHERCN_OPENAPI_DOMAIN", "openapi.weathercn.com")
28
+