clawshire-cli 0.1.0a2__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.
- clawshire_cli-0.1.0a2/PKG-INFO +410 -0
- clawshire_cli-0.1.0a2/README.md +401 -0
- clawshire_cli-0.1.0a2/clawshire_cli/__init__.py +1 -0
- clawshire_cli-0.1.0a2/clawshire_cli/commands/__init__.py +1 -0
- clawshire_cli-0.1.0a2/clawshire_cli/commands/annual_analysis.py +97 -0
- clawshire_cli-0.1.0a2/clawshire_cli/commands/annual_report.py +43 -0
- clawshire_cli-0.1.0a2/clawshire_cli/commands/auth.py +63 -0
- clawshire_cli-0.1.0a2/clawshire_cli/commands/notice.py +66 -0
- clawshire_cli-0.1.0a2/clawshire_cli/commands/user.py +21 -0
- clawshire_cli-0.1.0a2/clawshire_cli/config.py +61 -0
- clawshire_cli-0.1.0a2/clawshire_cli/context.py +19 -0
- clawshire_cli-0.1.0a2/clawshire_cli/main.py +67 -0
- clawshire_cli-0.1.0a2/clawshire_cli/output.py +103 -0
- clawshire_cli-0.1.0a2/clawshire_cli.egg-info/PKG-INFO +410 -0
- clawshire_cli-0.1.0a2/clawshire_cli.egg-info/SOURCES.txt +26 -0
- clawshire_cli-0.1.0a2/clawshire_cli.egg-info/dependency_links.txt +1 -0
- clawshire_cli-0.1.0a2/clawshire_cli.egg-info/entry_points.txt +3 -0
- clawshire_cli-0.1.0a2/clawshire_cli.egg-info/requires.txt +2 -0
- clawshire_cli-0.1.0a2/clawshire_cli.egg-info/top_level.txt +2 -0
- clawshire_cli-0.1.0a2/clawshire_sdk/__init__.py +15 -0
- clawshire_cli-0.1.0a2/clawshire_sdk/client.py +126 -0
- clawshire_cli-0.1.0a2/clawshire_sdk/domains/__init__.py +4 -0
- clawshire_cli-0.1.0a2/clawshire_sdk/domains/annual_reports.py +129 -0
- clawshire_cli-0.1.0a2/clawshire_sdk/domains/filings.py +58 -0
- clawshire_cli-0.1.0a2/clawshire_sdk/errors.py +22 -0
- clawshire_cli-0.1.0a2/pyproject.toml +40 -0
- clawshire_cli-0.1.0a2/setup.cfg +4 -0
- clawshire_cli-0.1.0a2/tests/test_clawshire_cli.py +73 -0
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: clawshire-cli
|
|
3
|
+
Version: 0.1.0a2
|
|
4
|
+
Summary: ClawShire CLI for notice query, annual report query, and annual analysis
|
|
5
|
+
Requires-Python: >=3.11
|
|
6
|
+
Description-Content-Type: text/markdown
|
|
7
|
+
Requires-Dist: httpx>=0.28.1
|
|
8
|
+
Requires-Dist: tomli-w>=1.2.0
|
|
9
|
+
|
|
10
|
+
# ClawShire CLI
|
|
11
|
+
|
|
12
|
+
独立可安装的 ClawShire 命令行客户端。
|
|
13
|
+
|
|
14
|
+
## 安装
|
|
15
|
+
|
|
16
|
+
当前优先使用内网 PyPI 安装:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
uv tool install --index http://192.168.41.95:8141/memect/dev/+simple/ clawshire-cli
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
如果本机已安装 `pipx`,也可通过内网源安装:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
PIP_INDEX_URL=http://192.168.41.95:8141/memect/dev/+simple/ pipx install clawshire-cli
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
本地开发可直接从源码目录安装:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
uv tool install ./clawshire-cli
|
|
32
|
+
pipx install ./clawshire-cli
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
说明:
|
|
36
|
+
|
|
37
|
+
1. 当前文档以内网安装方式为准
|
|
38
|
+
2. 未来如果公开发布到外网 PyPI,再补充公共安装命令
|
|
39
|
+
|
|
40
|
+
安装后可使用两个命令入口:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
clawshire --help
|
|
44
|
+
cs --help
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
如果你只想快速确认安装成功,先跑:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
clawshire --help
|
|
51
|
+
clawshire auth --help
|
|
52
|
+
clawshire user info --api-key <your_api_key>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## 3 分钟上手
|
|
56
|
+
|
|
57
|
+
把下面几条命令直接复制执行即可:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
uv tool install --index http://192.168.41.95:8141/memect/dev/+simple/ clawshire-cli
|
|
61
|
+
clawshire auth set-key <your_api_key>
|
|
62
|
+
clawshire user info
|
|
63
|
+
clawshire annual-analysis pdf-url https://static.cninfo.com.cn/finalpage/2026-04-20/1225116956.PDF
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
如果你要查公告或年报,再继续:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
clawshire notice search --start-date 2026-04-19 --end-date 2026-04-20
|
|
70
|
+
clawshire annual-report latest --year 2025 --keyword 平安银行
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## 先配置 API Key
|
|
74
|
+
|
|
75
|
+
建议先把 API Key 保存到本地,这样后续不用每次手动加 `--api-key`。
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
clawshire auth set-key <your_api_key>
|
|
79
|
+
clawshire auth show
|
|
80
|
+
clawshire user info
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
如果想临时覆盖本地配置,也可以直接传:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
clawshire --api-key <your_api_key> user info
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
清除本地保存的 Key:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
clawshire auth clear-key
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
## 命令
|
|
96
|
+
|
|
97
|
+
主命令分组:
|
|
98
|
+
|
|
99
|
+
1. `notice`
|
|
100
|
+
2. `annual-report`
|
|
101
|
+
3. `annual-analysis`
|
|
102
|
+
|
|
103
|
+
高频简写:
|
|
104
|
+
|
|
105
|
+
1. `gg` -> `notice`
|
|
106
|
+
2. `ar` -> `annual-report`
|
|
107
|
+
3. `aa` -> `annual-analysis`
|
|
108
|
+
|
|
109
|
+
## 全部命令能力
|
|
110
|
+
|
|
111
|
+
| 能力 | 命令 | 是否需要 API Key | 说明 |
|
|
112
|
+
|------|------|------------------|------|
|
|
113
|
+
| 保存 Key | `clawshire auth set-key <key>` | 否 | 保存本地 API Key |
|
|
114
|
+
| 查看认证配置 | `clawshire auth show` | 否 | 查看当前 base_url、key 掩码、输出格式、超时 |
|
|
115
|
+
| 清除 Key | `clawshire auth clear-key` | 否 | 清除本地保存的 API Key |
|
|
116
|
+
| 检查当前 Key | `clawshire auth whoami` | 是 | 校验当前 API Key 是否有效 |
|
|
117
|
+
| 用户信息 | `clawshire user info` | 是 | 查询余额、免费次数、配额等用户信息 |
|
|
118
|
+
| 公告按日期查询 | `clawshire notice search --start-date <d> --end-date <d>` | 否/建议有 | 按日期范围查询公告 |
|
|
119
|
+
| 公告按证券代码查询 | `clawshire notice stock <sec_code> --start-date <d> --end-date <d>` | 否/建议有 | 查询某证券代码公告 |
|
|
120
|
+
| 公告按链接查询 | `clawshire notice link --met-link <pdf_link>` | 否/建议有 | 按公告 PDF 链接查询 |
|
|
121
|
+
| 年报列表 | `clawshire annual-report latest --year <YYYY> --keyword <kw>` | 是 | 查询指定年份年报列表 |
|
|
122
|
+
| 年报结构化数据 | `clawshire annual-report data <met_uuid>` | 是 | 查询指定年报的结构化数据 |
|
|
123
|
+
| 年报分析: 本地文件 | `clawshire annual-analysis pdf-file <path>` | 是 | 上传本地 PDF 分析 |
|
|
124
|
+
| 年报分析: PDF 链接 | `clawshire annual-analysis pdf-url <url>` | 是 | 下载 PDF 链接后分析 |
|
|
125
|
+
| 年报分析: 公司 | `clawshire annual-analysis company <代码或简称> --year <YYYY>` | 是 | 先查询指定年份年报,再自动发起分析 |
|
|
126
|
+
| 查询分析任务 | `clawshire annual-analysis get <task_id_or_job_id>` | 是 | 查询分析任务状态或结果 |
|
|
127
|
+
|
|
128
|
+
简写命令:
|
|
129
|
+
|
|
130
|
+
| 简写 | 全称 | 示例 |
|
|
131
|
+
|------|------|------|
|
|
132
|
+
| `gg` | `notice` | `cs gg search --start-date 2026-04-19 --end-date 2026-04-20` |
|
|
133
|
+
| `ar` | `annual-report` | `cs ar latest --year 2025 --keyword 平安银行` |
|
|
134
|
+
| `aa` | `annual-analysis` | `cs aa company 000001 --year 2025` |
|
|
135
|
+
|
|
136
|
+
按命令分组查看帮助:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
clawshire auth --help
|
|
140
|
+
clawshire user --help
|
|
141
|
+
clawshire notice --help
|
|
142
|
+
clawshire annual-report --help
|
|
143
|
+
clawshire annual-analysis --help
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## 示例
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
clawshire user info
|
|
150
|
+
clawshire notice search --start-date 2026-04-01 --end-date 2026-04-20
|
|
151
|
+
clawshire annual-report latest --year 2025 --keyword 平安银行
|
|
152
|
+
clawshire annual-analysis pdf-file ./report.pdf
|
|
153
|
+
clawshire annual-analysis pdf-url https://example.com/report.pdf
|
|
154
|
+
clawshire annual-analysis company 000001 --year 2025
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
年报分析测试 PDF 示例:
|
|
158
|
+
|
|
159
|
+
```text
|
|
160
|
+
https://static.cninfo.com.cn/finalpage/2026-04-20/1225116956.PDF
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
推荐直接试:
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
clawshire annual-analysis pdf-url https://static.cninfo.com.cn/finalpage/2026-04-20/1225116956.PDF
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## 配置
|
|
170
|
+
|
|
171
|
+
支持环境变量:
|
|
172
|
+
|
|
173
|
+
1. `CLAWSHIRE_API_KEY`
|
|
174
|
+
2. `CLAWSHIRE_BASE_URL`
|
|
175
|
+
3. `CLAWSHIRE_OUTPUT`
|
|
176
|
+
4. `CLAWSHIRE_TIMEOUT`
|
|
177
|
+
|
|
178
|
+
如果你更习惯环境变量,可直接这样配置:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
export CLAWSHIRE_API_KEY=<your_api_key>
|
|
182
|
+
clawshire user info
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
## 最常用命令
|
|
186
|
+
|
|
187
|
+
查询用户信息:
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
clawshire user info
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
查询公告:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
clawshire notice search --start-date 2026-04-19 --end-date 2026-04-20
|
|
197
|
+
clawshire notice stock 000001 --start-date 2026-04-01 --end-date 2026-04-20
|
|
198
|
+
clawshire notice link --met-link <pdf_link>
|
|
199
|
+
```
|
|
200
|
+
|
|
201
|
+
查询年报:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
clawshire annual-report latest --year 2025 --keyword 平安银行
|
|
205
|
+
clawshire annual-report data <met_uuid>
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
发起年报分析:
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
clawshire annual-analysis pdf-file ./report.pdf
|
|
212
|
+
clawshire annual-analysis pdf-url https://static.cninfo.com.cn/finalpage/2026-04-20/1225116956.PDF
|
|
213
|
+
clawshire annual-analysis company 000001 --year 2025
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
查询分析任务:
|
|
217
|
+
|
|
218
|
+
```bash
|
|
219
|
+
clawshire annual-analysis get <task_id_or_job_id>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
## 必要提示
|
|
223
|
+
|
|
224
|
+
1. 全局参数要放在子命令前面,例如:`clawshire --output json user info`
|
|
225
|
+
2. `notice` 查询通常不需要 API Key,但如果本地配置了错误的 Key,可能会带上错误认证头
|
|
226
|
+
3. `annual-report`、`annual-analysis`、`user info` 都需要有效 API Key
|
|
227
|
+
4. CLI 不单独实现计费,仍然走服务端原有配额和计费逻辑
|
|
228
|
+
|
|
229
|
+
## 常见报错与处理
|
|
230
|
+
|
|
231
|
+
### 1. `认证失败: Authorization 格式错误,应为 Bearer <api_key>`
|
|
232
|
+
|
|
233
|
+
原因:
|
|
234
|
+
|
|
235
|
+
1. 本地保存了错误的 API Key
|
|
236
|
+
2. 环境变量里有错误的 `CLAWSHIRE_API_KEY`
|
|
237
|
+
3. 你传入的不是完整 API Key
|
|
238
|
+
|
|
239
|
+
处理:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
clawshire auth show
|
|
243
|
+
clawshire auth clear-key
|
|
244
|
+
clawshire auth set-key <your_api_key>
|
|
245
|
+
clawshire user info
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
如果你使用环境变量,也检查:
|
|
249
|
+
|
|
250
|
+
```bash
|
|
251
|
+
echo $CLAWSHIRE_API_KEY
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### 2. `配置错误: 该命令需要 API Key`
|
|
255
|
+
|
|
256
|
+
原因:
|
|
257
|
+
|
|
258
|
+
1. 你在调用需要认证的命令,但还没有配置 Key
|
|
259
|
+
|
|
260
|
+
处理:
|
|
261
|
+
|
|
262
|
+
```bash
|
|
263
|
+
clawshire auth set-key <your_api_key>
|
|
264
|
+
clawshire user info
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
或者临时传参:
|
|
268
|
+
|
|
269
|
+
```bash
|
|
270
|
+
clawshire --api-key <your_api_key> user info
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### 3. `unrecognized arguments: --output json`
|
|
274
|
+
|
|
275
|
+
原因:
|
|
276
|
+
|
|
277
|
+
1. 把全局参数写在了子命令后面
|
|
278
|
+
|
|
279
|
+
错误示例:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
clawshire notice search --start-date 2026-04-19 --end-date 2026-04-20 --output json
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
正确写法:
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
clawshire --output json notice search --start-date 2026-04-19 --end-date 2026-04-20
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
### 4. `未找到与 XXX 匹配的年报`
|
|
292
|
+
|
|
293
|
+
原因:
|
|
294
|
+
|
|
295
|
+
1. 公司代码或简称不匹配
|
|
296
|
+
2. 指定年份没有收录对应年报
|
|
297
|
+
3. 交易所筛选过窄
|
|
298
|
+
|
|
299
|
+
处理:
|
|
300
|
+
|
|
301
|
+
```bash
|
|
302
|
+
clawshire annual-report latest --year 2025 --keyword 平安银行
|
|
303
|
+
clawshire annual-report latest --year 2025 --keyword 000001
|
|
304
|
+
clawshire annual-analysis company 000001 --year 2025
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
如果仍然找不到,先去掉 `--exchange` 再试。
|
|
308
|
+
|
|
309
|
+
### 5. `查询分析任务` 没返回结果
|
|
310
|
+
|
|
311
|
+
原因:
|
|
312
|
+
|
|
313
|
+
1. `annual-analysis get` 传错了 ID
|
|
314
|
+
2. `pdf-file/pdf-url` 用的是 `job_id`
|
|
315
|
+
3. `company` 用的是平台异步分析 `task_id`
|
|
316
|
+
|
|
317
|
+
处理:
|
|
318
|
+
|
|
319
|
+
1. `pdf-file` / `pdf-url` 后续查询传 `job_id`
|
|
320
|
+
2. `company` 后续查询优先传 `task_id`
|
|
321
|
+
|
|
322
|
+
示例:
|
|
323
|
+
|
|
324
|
+
```bash
|
|
325
|
+
clawshire annual-analysis get 123
|
|
326
|
+
clawshire annual-analysis get job_xxx
|
|
327
|
+
```
|
|
328
|
+
|
|
329
|
+
## 发布流程
|
|
330
|
+
|
|
331
|
+
### 版本更新
|
|
332
|
+
|
|
333
|
+
1. 修改 [pyproject.toml](/Users/memect/work/code/sz_extract/hermeshub/clawshire-cli/pyproject.toml) 中的 `version`
|
|
334
|
+
2. 如有命令变化,同步更新本 README 与根目录 [README.md](/Users/memect/work/code/sz_extract/hermeshub/README.md)
|
|
335
|
+
|
|
336
|
+
### 本地构建
|
|
337
|
+
|
|
338
|
+
```bash
|
|
339
|
+
cd clawshire-cli
|
|
340
|
+
uv build
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
构建产物位于:
|
|
344
|
+
|
|
345
|
+
```text
|
|
346
|
+
clawshire-cli/dist/
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
### 本地安装验证
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
cd clawshire-cli
|
|
353
|
+
uv tool install .
|
|
354
|
+
clawshire --help
|
|
355
|
+
cs --help
|
|
356
|
+
clawshire notice search --start-date 2026-04-19 --end-date 2026-04-20
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
如果本机已安装 `pipx`,再补一轮:
|
|
360
|
+
|
|
361
|
+
```bash
|
|
362
|
+
cd clawshire-cli
|
|
363
|
+
pipx install .
|
|
364
|
+
clawshire --help
|
|
365
|
+
```
|
|
366
|
+
|
|
367
|
+
### 发布测试版
|
|
368
|
+
|
|
369
|
+
建议先发测试版,再发正式版,例如:
|
|
370
|
+
|
|
371
|
+
1. `0.1.0a1`
|
|
372
|
+
2. `0.1.0b1`
|
|
373
|
+
3. `0.1.0rc1`
|
|
374
|
+
|
|
375
|
+
发布命令示例:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
cd clawshire-cli
|
|
379
|
+
uv build
|
|
380
|
+
uv publish
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
如果要发到 TestPyPI:
|
|
384
|
+
|
|
385
|
+
```bash
|
|
386
|
+
cd clawshire-cli
|
|
387
|
+
uv build
|
|
388
|
+
uv publish --publish-url https://test.pypi.org/legacy/
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
如果要发到内网 PyPI:
|
|
392
|
+
|
|
393
|
+
```bash
|
|
394
|
+
cd clawshire-cli
|
|
395
|
+
uv build
|
|
396
|
+
uv publish --publish-url http://192.168.41.95:8141/memect/dev
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
安装验证:
|
|
400
|
+
|
|
401
|
+
```bash
|
|
402
|
+
uv tool install --index memect clawshire-cli
|
|
403
|
+
clawshire --help
|
|
404
|
+
cs --help
|
|
405
|
+
```
|
|
406
|
+
|
|
407
|
+
### 当前仓库内的限制
|
|
408
|
+
|
|
409
|
+
当前仓库环境没有可用的公共 PyPI / TestPyPI 发布凭据。
|
|
410
|
+
如果存在内网源可直连且无需额外凭据,则可以直接发布到内网源并验证安装链路。
|