lingxingapi 1.0.0__py3-none-any.whl
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 lingxingapi might be problematic. Click here for more details.
- lingxingapi/__init__.py +7 -0
- lingxingapi/ads/__init__.py +0 -0
- lingxingapi/ads/api.py +5946 -0
- lingxingapi/ads/param.py +192 -0
- lingxingapi/ads/route.py +134 -0
- lingxingapi/ads/schema.py +2615 -0
- lingxingapi/api.py +443 -0
- lingxingapi/base/__init__.py +0 -0
- lingxingapi/base/api.py +409 -0
- lingxingapi/base/param.py +59 -0
- lingxingapi/base/route.py +11 -0
- lingxingapi/base/schema.py +198 -0
- lingxingapi/basic/__init__.py +0 -0
- lingxingapi/basic/api.py +466 -0
- lingxingapi/basic/param.py +72 -0
- lingxingapi/basic/route.py +20 -0
- lingxingapi/basic/schema.py +212 -0
- lingxingapi/errors.py +143 -0
- lingxingapi/fba/__init__.py +0 -0
- lingxingapi/fba/api.py +1691 -0
- lingxingapi/fba/param.py +250 -0
- lingxingapi/fba/route.py +30 -0
- lingxingapi/fba/schema.py +987 -0
- lingxingapi/fields.py +50 -0
- lingxingapi/finance/__init__.py +0 -0
- lingxingapi/finance/api.py +3091 -0
- lingxingapi/finance/param.py +616 -0
- lingxingapi/finance/route.py +44 -0
- lingxingapi/finance/schema.py +1243 -0
- lingxingapi/product/__init__.py +0 -0
- lingxingapi/product/api.py +2643 -0
- lingxingapi/product/param.py +934 -0
- lingxingapi/product/route.py +49 -0
- lingxingapi/product/schema.py +1004 -0
- lingxingapi/purchase/__init__.py +0 -0
- lingxingapi/purchase/api.py +496 -0
- lingxingapi/purchase/param.py +126 -0
- lingxingapi/purchase/route.py +11 -0
- lingxingapi/purchase/schema.py +215 -0
- lingxingapi/sales/__init__.py +0 -0
- lingxingapi/sales/api.py +3200 -0
- lingxingapi/sales/param.py +723 -0
- lingxingapi/sales/route.py +70 -0
- lingxingapi/sales/schema.py +1718 -0
- lingxingapi/source/__init__.py +0 -0
- lingxingapi/source/api.py +1799 -0
- lingxingapi/source/param.py +176 -0
- lingxingapi/source/route.py +38 -0
- lingxingapi/source/schema.py +1011 -0
- lingxingapi/tools/__init__.py +0 -0
- lingxingapi/tools/api.py +291 -0
- lingxingapi/tools/param.py +73 -0
- lingxingapi/tools/route.py +8 -0
- lingxingapi/tools/schema.py +169 -0
- lingxingapi/utils.py +411 -0
- lingxingapi/warehourse/__init__.py +0 -0
- lingxingapi/warehourse/api.py +1778 -0
- lingxingapi/warehourse/param.py +506 -0
- lingxingapi/warehourse/route.py +28 -0
- lingxingapi/warehourse/schema.py +926 -0
- lingxingapi-1.0.0.dist-info/METADATA +67 -0
- lingxingapi-1.0.0.dist-info/RECORD +65 -0
- lingxingapi-1.0.0.dist-info/WHEEL +5 -0
- lingxingapi-1.0.0.dist-info/licenses/LICENSE +22 -0
- lingxingapi-1.0.0.dist-info/top_level.txt +1 -0
|
File without changes
|
lingxingapi/tools/api.py
ADDED
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-c
|
|
2
|
+
import datetime
|
|
3
|
+
from typing import Literal
|
|
4
|
+
from lingxingapi import errors
|
|
5
|
+
from lingxingapi.base.api import BaseAPI
|
|
6
|
+
from lingxingapi.tools import param, route, schema
|
|
7
|
+
|
|
8
|
+
# Type Aliases ---------------------------------------------------------------------------------------------------------
|
|
9
|
+
ALERT_SEARCH_FIELD = Literal["rule_name", "asin", "msku"]
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
# API ------------------------------------------------------------------------------------------------------------------
|
|
13
|
+
class ToolsAPI(BaseAPI):
|
|
14
|
+
"""领星API `工具数据` 接口
|
|
15
|
+
|
|
16
|
+
## Notice
|
|
17
|
+
请勿直接实例化此类
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
# 公共 API --------------------------------------------------------------------------------------
|
|
21
|
+
async def MonitorKeywords(
|
|
22
|
+
self,
|
|
23
|
+
*,
|
|
24
|
+
mid: int | None = None,
|
|
25
|
+
start_date: str | datetime.date | datetime.datetime | None = None,
|
|
26
|
+
end_date: str | datetime.date | datetime.datetime | None = None,
|
|
27
|
+
offset: int | None = None,
|
|
28
|
+
length: int | None = None,
|
|
29
|
+
) -> schema.MoniterKeywords:
|
|
30
|
+
"""查询关键词监控
|
|
31
|
+
|
|
32
|
+
## Docs
|
|
33
|
+
- 工具: [关键词列表](https://apidoc.lingxing.com/#/docs/Tools/GetKeywordList)
|
|
34
|
+
|
|
35
|
+
:param mid `<'str/None'>`: 领星站点ID列表 (Seller.mid), 默认 `None` (不筛选)
|
|
36
|
+
:param start_date `<'str/date/datetime/None'>`: 关键词监控创建开始日期,
|
|
37
|
+
参数来源 `MonitorKeyword.monitor_keyword_create_time`, 默认 `None` (不筛选)
|
|
38
|
+
:param end_date `<'str/date/datetime/None'>`: 关键词监控创建结束日期,
|
|
39
|
+
参数来源 `MonitorKeyword.monitor_keyword_create_time`
|
|
40
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
41
|
+
:param length `<'int/None'>`: 分页长度, 最大值 2000, 默认 `None` (使用: 20)
|
|
42
|
+
:return `<'MoniterKeywords'>`: 查询到的关键词监控结果
|
|
43
|
+
```python
|
|
44
|
+
{
|
|
45
|
+
# 状态码
|
|
46
|
+
"code": 0,
|
|
47
|
+
# 提示信息
|
|
48
|
+
"message": "success",
|
|
49
|
+
# 错误信息
|
|
50
|
+
"errors": [],
|
|
51
|
+
# 请求ID
|
|
52
|
+
"request_id": "",
|
|
53
|
+
# 响应时间
|
|
54
|
+
"response_time": "2025-08-13 19:23:04",
|
|
55
|
+
# 响应数据量
|
|
56
|
+
"response_count": 2,
|
|
57
|
+
# 总数据量
|
|
58
|
+
"total_count": 2,
|
|
59
|
+
# 响应数据
|
|
60
|
+
"data": [
|
|
61
|
+
{
|
|
62
|
+
# 关键词监控ID [原字段 'id']
|
|
63
|
+
"moniter_id": 44118,
|
|
64
|
+
# 关键词 [原字段 'key_word']
|
|
65
|
+
"keyword": "65 ink cartridge for hp printers",
|
|
66
|
+
# 关键词数量 [原字段 'keyword_num']
|
|
67
|
+
"keyword_count": 70,
|
|
68
|
+
# 关键词备注 [原字段 'keyword_remark']
|
|
69
|
+
"keyword_note": "",
|
|
70
|
+
# 监控终端 (1: PC端, 2: 移动端) [原字段 'type']
|
|
71
|
+
"moniter_type": 1,
|
|
72
|
+
# 监控国家 [原字段 'country']
|
|
73
|
+
"monitor_country": "美国",
|
|
74
|
+
# 监控邮编城市 [原字段 'postcode_name']
|
|
75
|
+
"monitor_city": "New york",
|
|
76
|
+
# 监控邮编 [原字段 'postcode']
|
|
77
|
+
"monitor_postcode": "10008",
|
|
78
|
+
# 监控排名类型 (0: 自然排名, 1: 广告排名) [原字段 'is_sponsored']
|
|
79
|
+
"rank_type": 0,
|
|
80
|
+
# 关键词排名
|
|
81
|
+
"rank": 75,
|
|
82
|
+
# 关键词排名页面 [原字段 'page']
|
|
83
|
+
"page": 5,
|
|
84
|
+
# 关键词页面排名 [原字段 'current_page_rank']
|
|
85
|
+
"page_rank": 11,
|
|
86
|
+
# 关键词排名描述 [原字段 'rank_text']
|
|
87
|
+
"rank_desc": "75(第5页第11名)",
|
|
88
|
+
# SBV广告排名页面 [原字段 'sbv_page']
|
|
89
|
+
"sbv_page": -1,
|
|
90
|
+
# SBV广告排名描述 [原字段 'sbv_text']
|
|
91
|
+
"sbv_desc": "",
|
|
92
|
+
# 关键词ASIN
|
|
93
|
+
"asin": "B0DP8QGQN7",
|
|
94
|
+
# 关键词父ASIN
|
|
95
|
+
"parent_asin": "",
|
|
96
|
+
# ASIN标题
|
|
97
|
+
"title": "",
|
|
98
|
+
# ASIN备注 [原字段 'asin_remark']
|
|
99
|
+
"asin_note": "",
|
|
100
|
+
# 监控创建人
|
|
101
|
+
"monitor_creator_name": "周思琪",
|
|
102
|
+
# 监控人列表
|
|
103
|
+
"monitor_user_names": ["周思琪"],
|
|
104
|
+
# ASIN监控创建时间 [原字段 'asin_create_time']
|
|
105
|
+
"monitor_asin_create_time": "2025-09-10 15:22",
|
|
106
|
+
# 关键词监控创建时间 [原字段 'create_time']
|
|
107
|
+
"monitor_keyword_create_time": "2025-09-10 15:23",
|
|
108
|
+
# 监控更新时间 [原字段 'monitor_time']
|
|
109
|
+
"update_time": "2025-09-17 02:00",
|
|
110
|
+
},
|
|
111
|
+
...
|
|
112
|
+
]
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
"""
|
|
116
|
+
url = route.MONITOR_KEYWORDS
|
|
117
|
+
# 构建参数
|
|
118
|
+
args = {
|
|
119
|
+
"mid": mid,
|
|
120
|
+
"start_date": start_date,
|
|
121
|
+
"end_date": end_date,
|
|
122
|
+
"offset": offset,
|
|
123
|
+
"length": length,
|
|
124
|
+
}
|
|
125
|
+
try:
|
|
126
|
+
p = param.MonitorKeywords.model_validate(args)
|
|
127
|
+
except Exception as err:
|
|
128
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
129
|
+
|
|
130
|
+
# 发送请求
|
|
131
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
132
|
+
return schema.MoniterKeywords.model_validate(data)
|
|
133
|
+
|
|
134
|
+
async def MonitorAsins(
|
|
135
|
+
self,
|
|
136
|
+
*,
|
|
137
|
+
start_time: str | datetime.date | datetime.datetime | None = None,
|
|
138
|
+
end_time: str | datetime.date | datetime.datetime | None = None,
|
|
139
|
+
monitor_levels: int | list[int] | None = None,
|
|
140
|
+
search_value: str | list[str] | None = None,
|
|
141
|
+
offset: int | None = None,
|
|
142
|
+
length: int | None = None,
|
|
143
|
+
) -> schema.MoniterAsins:
|
|
144
|
+
"""查询ASIN监控
|
|
145
|
+
|
|
146
|
+
## Docs
|
|
147
|
+
- 工具: [查询竞品监控列表](https://apidoc.lingxing.com/#/docs/Tools/CompetitiveMonitorList)
|
|
148
|
+
|
|
149
|
+
:param start_time `<'str/date/datetime/None'>`: 更新开始时间, 默认 `None` (不筛选)
|
|
150
|
+
:param end_time `<'str/date/datetime/None'>`: 更新结束时间, 默认 `None` (不筛选)
|
|
151
|
+
:param monitor_levels `<'int/list[int]/None'>`: 监控等级编码或编码列表 (1: A, 2: B, 3: C, 4: D), 默认 `None` (不筛选)
|
|
152
|
+
:param search_value `<'str/list[str]/None'>`: 搜索值, ASIN或ASIN列表, 默认 `None` (不筛选)
|
|
153
|
+
:param offset `<'int/None'>`: 分页偏移量, 默认 `None` (使用: 0)
|
|
154
|
+
:param length `<'int/None'>`: 分页长度, 最大值 200, 默认 `None` (使用: 20)
|
|
155
|
+
:return `<'MoniterAsins'>`: 查询到的ASIN监控结果
|
|
156
|
+
```python
|
|
157
|
+
{
|
|
158
|
+
# 状态码
|
|
159
|
+
"code": 0,
|
|
160
|
+
# 提示信息
|
|
161
|
+
"message": "success",
|
|
162
|
+
# 错误信息
|
|
163
|
+
"errors": [],
|
|
164
|
+
# 请求ID
|
|
165
|
+
"request_id": "",
|
|
166
|
+
# 响应时间
|
|
167
|
+
"response_time": "2025-08-13 19:23:04",
|
|
168
|
+
# 响应数据量
|
|
169
|
+
"response_count": 2,
|
|
170
|
+
# 总数据量
|
|
171
|
+
"total_count": 2,
|
|
172
|
+
# 响应数据
|
|
173
|
+
"data": [
|
|
174
|
+
{
|
|
175
|
+
# 监控状态 (0: 关闭, 1: 开启)
|
|
176
|
+
"monitor_status": 1,
|
|
177
|
+
# 监控等级 (1: A, 2: B, 3: C, 4: D) [原字段 'level_name']
|
|
178
|
+
"monitor_level": "A",
|
|
179
|
+
# 领星站点ID
|
|
180
|
+
"mid": 5,
|
|
181
|
+
# 监控ASIN
|
|
182
|
+
"asin": "B0B*******",
|
|
183
|
+
# 父ASIN [原字段 'parent']
|
|
184
|
+
"parent_asin": "",
|
|
185
|
+
# 关联的子ASIN列表 [原字段 'children']
|
|
186
|
+
"child_asins": [],
|
|
187
|
+
# ASIN链接
|
|
188
|
+
"asin_url": "https://www.amazon.de/dp/B0B*******",
|
|
189
|
+
# 商品主图 [原字段 'main_image']
|
|
190
|
+
"image_url": "https://m.media-amazon.com/images/I/****.jpg",
|
|
191
|
+
# ASIN所属类目列表 [原字段 'category_list']
|
|
192
|
+
"asin_categories": [],
|
|
193
|
+
# 商品价格
|
|
194
|
+
"price": 32.98,
|
|
195
|
+
# 商品价格货币符号 [原字段 'currency']
|
|
196
|
+
"price_currency_icon": "€",
|
|
197
|
+
# BuyBox当前价格
|
|
198
|
+
"buybox_price": 32.98,
|
|
199
|
+
# BuyBox初始价格 [原字段 'init_buybox_price']
|
|
200
|
+
"buybox_init_price": 32.99,
|
|
201
|
+
# BuyBox价格货币符号 [原字段 'buybox_currency']
|
|
202
|
+
"buybox_currency_icon": "€",
|
|
203
|
+
# BuyBox美元价格
|
|
204
|
+
"buybox_usd_price": 35.6,
|
|
205
|
+
# 30天平均价格 [原字段 'avg_price']
|
|
206
|
+
"price_avg_30d": 0.0,
|
|
207
|
+
# 30天平均价格货币符号 [原字段 'avg_currency']
|
|
208
|
+
"price_avg_currency_icon": "$",
|
|
209
|
+
# 30天预估销量 [原字段 'bought_num']
|
|
210
|
+
"sales_qty_30d": 2000,
|
|
211
|
+
# 评论分 [原字段 'star']
|
|
212
|
+
"review_score": "4.2",
|
|
213
|
+
# 评论数 [原字段 'review_num']
|
|
214
|
+
"review_count": "16",
|
|
215
|
+
# 大类目名称 [原字段 'big_category']
|
|
216
|
+
"category": "Computer & Zubehör",
|
|
217
|
+
# 大类目排名 [原字段 'big_category_rank']
|
|
218
|
+
"category_rank": "670",
|
|
219
|
+
# 大类目初始排名 [原字段 'init_big_category_rank']
|
|
220
|
+
"category_init_rank": 355,
|
|
221
|
+
# 小类目排名 [原字段 'small_ranks']
|
|
222
|
+
"subcategories": [
|
|
223
|
+
{
|
|
224
|
+
# 小类目名称 [原字段 'small_category_text']
|
|
225
|
+
"subcategory": "Tintenpatronen für Tintenstrahldrucker",
|
|
226
|
+
# 小类目排名 [原字段 'small_rank']
|
|
227
|
+
"subcategory_rank": 73,
|
|
228
|
+
# 小类目初始排名 [原字段 'init_small_rank']
|
|
229
|
+
"subcategory_init_rank": 44,
|
|
230
|
+
},
|
|
231
|
+
...
|
|
232
|
+
],
|
|
233
|
+
# FBA卖家数量 [原字段 'fba_seller_num']
|
|
234
|
+
"fba_seller_count": 1,
|
|
235
|
+
# 初始FBA卖家数量 [原字段 'init_fba_seller_num']
|
|
236
|
+
"fba_seller_init_count": 0,
|
|
237
|
+
# FBM卖家数量 [原字段 'fbm_seller_num']
|
|
238
|
+
"fbm_seller_count": 0,
|
|
239
|
+
# 初始FBM卖家数量 [原字段 'init_fbm_seller_num']
|
|
240
|
+
"fbm_seller_init_count": 0,
|
|
241
|
+
# 商品重量
|
|
242
|
+
"item_weight": " 130 Gramm",
|
|
243
|
+
# 商品尺寸
|
|
244
|
+
"product_dimensions": "4,2 x 14,7 x 7,4 cm",
|
|
245
|
+
# 搜索词
|
|
246
|
+
"search_term": "",
|
|
247
|
+
# 最新更新事件列表 [原字段 'last_update_event']
|
|
248
|
+
"latest_update_events": ["优惠券价格"],
|
|
249
|
+
# 商品图片列表 [原字段 'thumbnail']
|
|
250
|
+
"images": [
|
|
251
|
+
"https://m.media-amazon.com/images/I/****.jpg",
|
|
252
|
+
...
|
|
253
|
+
],
|
|
254
|
+
# 商品标题
|
|
255
|
+
"title": "Product Title",
|
|
256
|
+
# 商品卖点 [原字段 'featurebullets']
|
|
257
|
+
"bullet_points": [
|
|
258
|
+
"bullet point 1",
|
|
259
|
+
...
|
|
260
|
+
],
|
|
261
|
+
# 监控创建人ID [原字段 'creator_uid']
|
|
262
|
+
"creator_id": "106*****",
|
|
263
|
+
# 监控创建人名称 [原字段 'creator']
|
|
264
|
+
"creator_name": "白小白",
|
|
265
|
+
# 监控人ID列表 [原字段 'monitor_uids']
|
|
266
|
+
"monitor_user_ids": ["106*****"],
|
|
267
|
+
}
|
|
268
|
+
...
|
|
269
|
+
]
|
|
270
|
+
}
|
|
271
|
+
```
|
|
272
|
+
"""
|
|
273
|
+
url = route.MONITOR_ASINS
|
|
274
|
+
# 构建参数
|
|
275
|
+
args = {
|
|
276
|
+
"start_time": start_time,
|
|
277
|
+
"end_time": end_time,
|
|
278
|
+
"monitor_levels": monitor_levels,
|
|
279
|
+
"search_field": "asin",
|
|
280
|
+
"search_value": search_value,
|
|
281
|
+
"offset": offset,
|
|
282
|
+
"length": length,
|
|
283
|
+
}
|
|
284
|
+
try:
|
|
285
|
+
p = param.MonitorAsins.model_validate(args)
|
|
286
|
+
except Exception as err:
|
|
287
|
+
raise errors.InvalidParametersError(err, url, args) from err
|
|
288
|
+
|
|
289
|
+
# 发送请求
|
|
290
|
+
data = await self._request_with_sign("POST", url, body=p.model_dump_params())
|
|
291
|
+
return schema.MoniterAsins.model_validate(data)
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from typing import Any, Optional
|
|
3
|
+
from typing_extensions import Self
|
|
4
|
+
from pydantic import ValidationInfo, Field, field_validator, model_validator
|
|
5
|
+
from lingxingapi import utils
|
|
6
|
+
from lingxingapi.base.param import Parameter, PageOffestAndLength
|
|
7
|
+
from lingxingapi.fields import NonEmptyStr, NonNegativeInt, CurrencyCode
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
# 工具数据 ----------------------------------------------------------------------------------------------------------------------
|
|
11
|
+
# . Monitor Keywords
|
|
12
|
+
class MonitorKeywords(PageOffestAndLength):
|
|
13
|
+
"""查询关键词参数"""
|
|
14
|
+
|
|
15
|
+
# 领星站点ID列表 (Seller.mid)
|
|
16
|
+
mid: Optional[NonNegativeInt] = None
|
|
17
|
+
# 关键词监控创建开始日期
|
|
18
|
+
start_date: Optional[str] = None
|
|
19
|
+
# 关键词监控创建结束日期
|
|
20
|
+
end_date: Optional[str] = None
|
|
21
|
+
|
|
22
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
23
|
+
@field_validator("start_date", "end_date", mode="before")
|
|
24
|
+
@classmethod
|
|
25
|
+
def _validate_date(cls, v: Any, info: ValidationInfo) -> Optional[str]:
|
|
26
|
+
if v is None:
|
|
27
|
+
return v
|
|
28
|
+
dt = utils.validate_datetime(v, False, "关键词创建日期 %s" % info.field_name)
|
|
29
|
+
return "%4d-%02d-%02d" % (dt.year, dt.month, dt.day)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
# . Monitor Asins
|
|
33
|
+
class MonitorAsins(PageOffestAndLength):
|
|
34
|
+
"""查询ASIN监控参数"""
|
|
35
|
+
|
|
36
|
+
# 更新开始时间
|
|
37
|
+
start_time: Optional[str] = None
|
|
38
|
+
# 更新结束时间
|
|
39
|
+
end_time: Optional[str] = None
|
|
40
|
+
# 监控等级 (1: A, 2: B, 3: C, 4: D)
|
|
41
|
+
monitor_levels: Optional[list] = Field(None, alias="levels")
|
|
42
|
+
# 搜索字段
|
|
43
|
+
search_field: Optional[NonEmptyStr] = None
|
|
44
|
+
# 搜索值
|
|
45
|
+
search_value: Optional[NonEmptyStr] = None
|
|
46
|
+
|
|
47
|
+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
48
|
+
@field_validator("start_time", "end_time", mode="before")
|
|
49
|
+
@classmethod
|
|
50
|
+
def _validate_datetime(cls, v: Any, info: ValidationInfo) -> Optional[str]:
|
|
51
|
+
if v is None:
|
|
52
|
+
return v
|
|
53
|
+
dt = utils.validate_datetime(v, True, "更新时间 %s" % info.field_name)
|
|
54
|
+
# fmt: off
|
|
55
|
+
return "%4d-%02d-%02d %02d:%02d:%02d" % (
|
|
56
|
+
dt.year, dt.month, dt.day,
|
|
57
|
+
dt.hour, dt.minute, dt.second
|
|
58
|
+
)
|
|
59
|
+
# fmt: on
|
|
60
|
+
|
|
61
|
+
@field_validator("monitor_levels", mode="before")
|
|
62
|
+
@classmethod
|
|
63
|
+
def _validate_levels(cls, v) -> list[int] | None:
|
|
64
|
+
if v is None:
|
|
65
|
+
return None
|
|
66
|
+
return utils.validate_array_of_unsigned_int(v, "监控等级 monitor_levels")
|
|
67
|
+
|
|
68
|
+
@field_validator("search_value", mode="before")
|
|
69
|
+
@classmethod
|
|
70
|
+
def _validate_search_value(cls, v) -> str | None:
|
|
71
|
+
if v is None:
|
|
72
|
+
return None
|
|
73
|
+
return ",".join(utils.validate_array_of_non_empty_str(v, "搜索值 search_value"))
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
# fmt: off
|
|
4
|
+
# 工具数据 ----------------------------------------------------------------------------------------------------------------------
|
|
5
|
+
# https://apidoc.lingxing.com/#/docs/Tools/GetKeywordList
|
|
6
|
+
MONITOR_KEYWORDS: str = "/erp/sc/routing/tool/toolKeywordRank/getKeywordList"
|
|
7
|
+
# https://apidoc.lingxing.com/#/docs/Tools/CompetitiveMonitorList
|
|
8
|
+
MONITOR_ASINS: str = "/basicOpen/tool/competitiveMonitor/list"
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
from typing import Any
|
|
3
|
+
from pydantic import BaseModel, Field, field_validator
|
|
4
|
+
from lingxingapi.base.schema import ResponseV1, ResponseV1TraceId, FlattenDataRecords
|
|
5
|
+
from lingxingapi.fields import IntOrNone2Zero, FloatOrNone2Zero, StrOrNone2Blank
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
# 工具数据 ----------------------------------------------------------------------------------------------------------------------
|
|
9
|
+
# . Minitor Keywords
|
|
10
|
+
class MoniterKeyword(BaseModel):
|
|
11
|
+
"""关键词监控"""
|
|
12
|
+
|
|
13
|
+
# 关键词监控ID [原字段 'id']
|
|
14
|
+
moniter_id: int = Field(validation_alias="id")
|
|
15
|
+
# 关键词 [原字段 'key_word']
|
|
16
|
+
keyword: str = Field(validation_alias="key_word")
|
|
17
|
+
# 关键词数量 [原字段 'keyword_num']
|
|
18
|
+
keyword_count: int = Field(validation_alias="keyword_num")
|
|
19
|
+
# 关键词备注 [原字段 'keyword_remark']
|
|
20
|
+
keyword_note: str = Field(validation_alias="keyword_remark")
|
|
21
|
+
# 监控终端 [原字段 'type']
|
|
22
|
+
# (1: PC端, 2: 移动端)
|
|
23
|
+
moniter_type: int = Field(validation_alias="type")
|
|
24
|
+
# 监控国家 [原字段 'country']
|
|
25
|
+
monitor_country: str = Field(validation_alias="country")
|
|
26
|
+
# 监控邮编城市 [原字段 'postcode_name']
|
|
27
|
+
monitor_city: str = Field(validation_alias="postcode_name")
|
|
28
|
+
# 监控邮编 [原字段 'postcode']
|
|
29
|
+
monitor_postcode: str = Field(validation_alias="postcode")
|
|
30
|
+
# 监控排名类型 [原字段 'is_sponsored']
|
|
31
|
+
# (0: 自然排名, 1: 广告排名)
|
|
32
|
+
rank_type: int = Field(validation_alias="is_sponsored")
|
|
33
|
+
# 关键词排名
|
|
34
|
+
rank: int
|
|
35
|
+
# 关键词排名页面 [原字段 'page']
|
|
36
|
+
page: int = Field(validation_alias="page")
|
|
37
|
+
# 关键词页面排名 [原字段 'current_page_rank']
|
|
38
|
+
page_rank: int = Field(validation_alias="current_page_rank")
|
|
39
|
+
# 关键词排名描述 [原字段 'rank_text']
|
|
40
|
+
rank_desc: str = Field(validation_alias="rank_text")
|
|
41
|
+
# SBV广告排名页面 [原字段 'sbv_page']
|
|
42
|
+
sbv_page: int = Field(validation_alias="sbv_page")
|
|
43
|
+
# SBV广告排名描述 [原字段 'sbv_text']
|
|
44
|
+
sbv_desc: str = Field(validation_alias="sbv_text")
|
|
45
|
+
# 关键词ASIN
|
|
46
|
+
asin: str
|
|
47
|
+
# 关键词父ASIN
|
|
48
|
+
parent_asin: str
|
|
49
|
+
# ASIN标题
|
|
50
|
+
title: str
|
|
51
|
+
# ASIN备注 [原字段 'asin_remark']
|
|
52
|
+
asin_note: str = Field(validation_alias="asin_remark")
|
|
53
|
+
# 监控创建人
|
|
54
|
+
monitor_creator_name: str = Field(validation_alias="creator")
|
|
55
|
+
# 监控人列表
|
|
56
|
+
monitor_user_names: list[str] = Field(validation_alias="monitors")
|
|
57
|
+
# ASIN监控创建时间 [原字段 'asin_create_time']
|
|
58
|
+
monitor_asin_create_time: str = Field(validation_alias="asin_create_time")
|
|
59
|
+
# 关键词监控创建时间 [原字段 'create_time']
|
|
60
|
+
monitor_keyword_create_time: str = Field(validation_alias="create_time")
|
|
61
|
+
# 监控更新时间 [原字段 'monitor_time']
|
|
62
|
+
update_time: str = Field(validation_alias="monitor_time")
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class MoniterKeywords(ResponseV1):
|
|
66
|
+
"""关键词监控列表"""
|
|
67
|
+
|
|
68
|
+
data: list[MoniterKeyword]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# . Product Asins
|
|
72
|
+
class SubcategoryRank(BaseModel):
|
|
73
|
+
"""小类目排名"""
|
|
74
|
+
|
|
75
|
+
# 小类目名称 [原字段 'small_category_text']
|
|
76
|
+
subcategory: str = Field(validation_alias="small_category_text")
|
|
77
|
+
# 小类目排名 [原字段 'small_rank']
|
|
78
|
+
subcategory_rank: int = Field(validation_alias="small_rank")
|
|
79
|
+
# 小类目初始排名 [原字段 'init_small_rank']
|
|
80
|
+
subcategory_init_rank: int = Field(validation_alias="init_small_rank")
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
class MinitorAsin(BaseModel):
|
|
84
|
+
"""ASIN监控"""
|
|
85
|
+
|
|
86
|
+
# fmt: off
|
|
87
|
+
# 监控状态 (0: 关闭, 1: 开启)
|
|
88
|
+
monitor_status: int
|
|
89
|
+
# 监控等级 (1: A, 2: B, 3: C, 4: D) [原字段 'level_name']
|
|
90
|
+
monitor_level: str = Field(validation_alias="level_name")
|
|
91
|
+
# 领星站点ID
|
|
92
|
+
mid: int
|
|
93
|
+
# 监控ASIN
|
|
94
|
+
asin: str
|
|
95
|
+
# 父ASIN [原字段 'parent']
|
|
96
|
+
parent_asin: StrOrNone2Blank = Field(validation_alias="parent")
|
|
97
|
+
# 关联的子ASIN列表 [原字段 'children']
|
|
98
|
+
child_asins: list[str] = Field(validation_alias="children")
|
|
99
|
+
# ASIN链接
|
|
100
|
+
asin_url: StrOrNone2Blank
|
|
101
|
+
# 商品主图 [原字段 'main_image']
|
|
102
|
+
image_url: StrOrNone2Blank = Field(validation_alias="main_image")
|
|
103
|
+
# ASIN所属类目列表 [原字段 'category_list']
|
|
104
|
+
asin_categories: list[str] = Field(validation_alias="category_list")
|
|
105
|
+
# 商品价格
|
|
106
|
+
price: FloatOrNone2Zero
|
|
107
|
+
# 商品价格货币符号 [原字段 'currency']
|
|
108
|
+
price_currency_icon: StrOrNone2Blank = Field(validation_alias="currency")
|
|
109
|
+
# BuyBox当前价格
|
|
110
|
+
buybox_price: FloatOrNone2Zero
|
|
111
|
+
# BuyBox初始价格 [原字段 'init_buybox_price']
|
|
112
|
+
buybox_init_price: FloatOrNone2Zero = Field(validation_alias="init_buybox_price")
|
|
113
|
+
# BuyBox价格货币符号 [原字段 'buybox_currency']
|
|
114
|
+
buybox_currency_icon: StrOrNone2Blank = Field(validation_alias="buybox_currency")
|
|
115
|
+
# BuyBox美元价格
|
|
116
|
+
buybox_usd_price: FloatOrNone2Zero
|
|
117
|
+
# 30天平均价格 [原字段 'avg_price']
|
|
118
|
+
price_avg_30d: FloatOrNone2Zero = Field(validation_alias="avg_price")
|
|
119
|
+
# 30天平均价格货币符号 [原字段 'avg_currency']
|
|
120
|
+
price_avg_currency_icon: StrOrNone2Blank = Field(validation_alias="avg_currency")
|
|
121
|
+
# 30天预估销量 [原字段 'bought_num']
|
|
122
|
+
sales_qty_30d: IntOrNone2Zero = Field(validation_alias="bought_num")
|
|
123
|
+
# 评论分 [原字段 'star']
|
|
124
|
+
review_score: StrOrNone2Blank = Field(validation_alias="star")
|
|
125
|
+
# 评论数 [原字段 'review_num']
|
|
126
|
+
review_count: StrOrNone2Blank = Field(validation_alias="review_num")
|
|
127
|
+
# 大类目名称 [原字段 'big_category']
|
|
128
|
+
category: StrOrNone2Blank = Field(validation_alias="big_category")
|
|
129
|
+
# 大类目排名 [原字段 'big_category_rank']
|
|
130
|
+
category_rank: StrOrNone2Blank = Field(validation_alias="big_category_rank")
|
|
131
|
+
# 大类目初始排名 [原字段 'init_big_category_rank']
|
|
132
|
+
category_init_rank: IntOrNone2Zero = Field(validation_alias="init_big_category_rank")
|
|
133
|
+
# 小类目排名 [原字段 'small_ranks']
|
|
134
|
+
subcategories: list[SubcategoryRank] = Field(validation_alias="small_ranks")
|
|
135
|
+
# FBA卖家数量 [原字段 'fba_seller_num']
|
|
136
|
+
fba_seller_count: IntOrNone2Zero = Field(validation_alias="fba_seller_num")
|
|
137
|
+
# 初始FBA卖家数量 [原字段 'init_fba_seller_num']
|
|
138
|
+
fba_seller_init_count: IntOrNone2Zero = Field(validation_alias="init_fba_seller_num")
|
|
139
|
+
# FBM卖家数量 [原字段 'fbm_seller_num']
|
|
140
|
+
fbm_seller_count: IntOrNone2Zero = Field(validation_alias="fbm_seller_num")
|
|
141
|
+
# 初始FBM卖家数量 [原字段 'init_fbm_seller_num']
|
|
142
|
+
fbm_seller_init_count: IntOrNone2Zero = Field(validation_alias="init_fbm_seller_num")
|
|
143
|
+
# 商品重量
|
|
144
|
+
item_weight: StrOrNone2Blank
|
|
145
|
+
# 商品尺寸
|
|
146
|
+
product_dimensions: str
|
|
147
|
+
# 搜索词
|
|
148
|
+
search_term: str
|
|
149
|
+
# 最新更新事件列表 [原字段 'last_update_event']
|
|
150
|
+
latest_update_events: list[str] = Field(validation_alias="last_update_event")
|
|
151
|
+
# 商品图片列表 [原字段 'thumbnail']
|
|
152
|
+
images: list[str] = Field(validation_alias="thumbnail")
|
|
153
|
+
# 商品标题
|
|
154
|
+
title: str
|
|
155
|
+
# 商品卖点 [原字段 'featurebullets']
|
|
156
|
+
bullet_points: list[str] = Field(validation_alias="featurebullets")
|
|
157
|
+
# 监控创建人ID [原字段 'creator_uid']
|
|
158
|
+
creator_id: str = Field(validation_alias="creator_uid")
|
|
159
|
+
# 监控创建人名称 [原字段 'creator']
|
|
160
|
+
creator_name: str = Field(validation_alias="creator")
|
|
161
|
+
# 监控人ID列表 [原字段 'monitor_uids']
|
|
162
|
+
monitor_user_ids: list[str] = Field(validation_alias="monitor_uids")
|
|
163
|
+
# fmt: on
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
class MoniterAsins(ResponseV1):
|
|
167
|
+
"""ASIN监控列表"""
|
|
168
|
+
|
|
169
|
+
data: list[MinitorAsin]
|