qrpa 1.0.24__py3-none-any.whl → 1.0.25__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 qrpa might be problematic. Click here for more details.

qrpa/shein_lib.py CHANGED
@@ -83,6 +83,287 @@ class SheinLib:
83
83
  # web_page.goto('https://sso.geiwohuo.com')
84
84
  log('鉴权处理结束')
85
85
 
86
+ # 获取希音退供明细 和 台账明细一个接口
87
+ def get_back_list(self, source='mb'):
88
+ page_num = 1
89
+ page_size = 200 # 列表最多返回200条数据 大了没有用
90
+
91
+ first_day, last_day = TimeUtils.get_last_month_range()
92
+
93
+ cache_file = f'{self.config.auto_dir}/shein/cache/return_detail_{self.store_username}_{first_day}_{last_day}.json'
94
+ list_item = read_dict_from_file(cache_file, 3600 * 24 * 20)
95
+ if len(list_item) > 0:
96
+ return list_item
97
+
98
+ url = f"https://sso.geiwohuo.com/mils/changeDetail/page"
99
+ payload = {
100
+ "displayChangeTypeList": ["10"],
101
+ "addTimeStart" : f"{first_day} 00:00:00",
102
+ "addTimeEnd" : f"{last_day} 23:59:59",
103
+ "pageNumber" : page_num,
104
+ "pageSize" : page_size,
105
+ "changeTypeIndex" : "2"
106
+ }
107
+ response_text = fetch(self.web_page, url, payload)
108
+ error_code = response_text.get('code')
109
+ if str(error_code) != '0':
110
+ raise send_exception(json.dumps(response_text, ensure_ascii=False))
111
+ list_item = response_text['info']['data']['list']
112
+ total = response_text['info']['data']['count']
113
+ totalPage = math.ceil(total / page_size)
114
+
115
+ for page in range(2, totalPage + 1):
116
+ log(f'获取台账明细列表 第{page}/{totalPage}页')
117
+ payload['pageNumber'] = page
118
+ response_text = fetch(self.web_page, url, payload)
119
+ spu_list_new = response_text['info']['data']['list']
120
+ list_item += spu_list_new
121
+ time.sleep(0.1)
122
+
123
+ # cost_price =
124
+ for item in list_item:
125
+ supplierSku = item['supplierSku']
126
+ item['cost_price'] = self.bridge.get_sku_cost(supplierSku, source)
127
+ item['sku_img'] = self.bridge.get_sku_img(supplierSku, source)
128
+
129
+ write_dict_to_file(cache_file, list_item)
130
+
131
+ return list_item
132
+
133
+ # 不结算列表
134
+ def get_no_settlement_list(self, source='mb'):
135
+ page_num = 1
136
+ page_size = 200 # 列表最多返回200条数据 大了没有用
137
+
138
+ first_day, last_day = TimeUtils.get_last_month_range()
139
+
140
+ cache_file = f'{self.config.auto_dir}/shein/cache/no_settlement_{self.store_username}_{first_day}_{last_day}.json'
141
+ list_item = read_dict_from_file(cache_file, 3600 * 24 * 20)
142
+ if len(list_item) > 0:
143
+ return list_item
144
+
145
+ url = f"https://sso.geiwohuo.com/mils/changeDetail/page"
146
+ payload = {
147
+ "addTimeStart" : f"{first_day} 00:00:00",
148
+ "addTimeEnd" : f"{last_day} 23:59:59",
149
+ "pageNumber" : page_num,
150
+ "pageSize" : page_size,
151
+ "changeTypeIndex" : "2",
152
+ "settleTypeList" : ["1"], # 不结算
153
+ "displayChangeTypeList": ["6", "7", "9", "10", "11", "12", "13", "16", "18", "19"] # 出库
154
+ }
155
+ response_text = fetch(self.web_page, url, payload)
156
+ error_code = response_text.get('code')
157
+ if str(error_code) != '0':
158
+ raise send_exception(json.dumps(response_text, ensure_ascii=False))
159
+ list_item = response_text['info']['data']['list']
160
+ total = response_text['info']['data']['count']
161
+ totalPage = math.ceil(total / page_size)
162
+
163
+ for page in range(2, totalPage + 1):
164
+ log(f'获取台账明细列表 第{page}/{totalPage}页')
165
+ payload['pageNumber'] = page
166
+ response_text = fetch(self.web_page, url, payload)
167
+ spu_list_new = response_text['info']['data']['list']
168
+ list_item += spu_list_new
169
+ time.sleep(0.1)
170
+
171
+ # cost_price =
172
+ for item in list_item:
173
+ supplierSku = item['supplierSku']
174
+ item['cost_price'] = self.bridge.get_sku_cost(supplierSku, source)
175
+ item['sku_img'] = self.bridge.get_sku_img(supplierSku, source)
176
+
177
+ write_dict_to_file(cache_file, list_item)
178
+
179
+ return list_item
180
+
181
+ def get_ledger_list(self, source='mb'):
182
+ page_num = 1
183
+ page_size = 200 # 列表最多返回200条数据 大了没有用
184
+
185
+ first_day, last_day = TimeUtils.get_last_month_range()
186
+
187
+ cache_file = f'{self.config.auto_dir}/shein/cache/sales_detail_{self.store_username}_{first_day}_{last_day}.json'
188
+ list_item = read_dict_from_file(cache_file, 3600 * 24 * 20)
189
+ if len(list_item) > 0:
190
+ return list_item
191
+
192
+ url = f"https://sso.geiwohuo.com/mils/changeDetail/page"
193
+ payload = {
194
+ "displayChangeTypeList": ["6", "7", "9", "10", "11", "12", "13", "16", "18", "19"], # 出库
195
+ "addTimeStart" : f"{first_day} 00:00:00",
196
+ "addTimeEnd" : f"{last_day} 23:59:59",
197
+ "pageNumber" : page_num,
198
+ "pageSize" : page_size,
199
+ "changeTypeIndex" : "2"
200
+ }
201
+ response_text = fetch(self.web_page, url, payload)
202
+ error_code = response_text.get('code')
203
+ if str(error_code) != '0':
204
+ raise send_exception(json.dumps(response_text, ensure_ascii=False))
205
+ list_item = response_text['info']['data']['list']
206
+ total = response_text['info']['data']['count']
207
+ totalPage = math.ceil(total / page_size)
208
+
209
+ for page in range(2, totalPage + 1):
210
+ log(f'获取台账明细列表 第{page}/{totalPage}页')
211
+ payload['pageNumber'] = page
212
+ response_text = fetch(self.web_page, url, payload)
213
+ spu_list_new = response_text['info']['data']['list']
214
+ list_item += spu_list_new
215
+ time.sleep(0.1)
216
+
217
+ # cost_price =
218
+ for item in list_item:
219
+ supplierSku = item['supplierSku']
220
+ item['cost_price'] = self.bridge.get_sku_cost(supplierSku, source)
221
+ item['sku_img'] = self.bridge.get_sku_img(supplierSku, source)
222
+
223
+ write_dict_to_file(cache_file, list_item)
224
+
225
+ return list_item
226
+
227
+ def get_shein_stock_list(self, source='mb'):
228
+ page_num = 1
229
+ page_size = 200 # 列表最多返回200条数据 大了没有用
230
+
231
+ first_day, last_day = TimeUtils.get_last_month_range()
232
+
233
+ cache_file = f'{self.config.auto_dir}/shein/cache/stock_detail_{self.store_username}_{first_day}_{last_day}.json'
234
+ list_item = read_dict_from_file(cache_file, 3600 * 24 * 20)
235
+ if len(list_item) > 0:
236
+ return list_item
237
+
238
+ url = f"https://sso.geiwohuo.com/mils/report/month/detail/list"
239
+ payload = {
240
+ "reportDateStart": first_day,
241
+ "reportDateEnd" : last_day,
242
+ "pageNumber" : page_num,
243
+ "pageSize" : page_size,
244
+ }
245
+ response_text = fetch(self.web_page, url, payload)
246
+ error_code = response_text.get('code')
247
+ if str(error_code) != '0':
248
+ raise send_exception(json.dumps(response_text, ensure_ascii=False))
249
+ list_item = response_text['info']['data']['list']
250
+ total = response_text['info']['data']['count']
251
+ totalPage = math.ceil(total / page_size)
252
+
253
+ for page in range(2, totalPage + 1):
254
+ log(f'获取库存结余明细列表 第{page}/{totalPage}页')
255
+ page_num = page
256
+ payload = {
257
+ "reportDateStart": first_day,
258
+ "reportDateEnd" : last_day,
259
+ "pageNumber" : page_num,
260
+ "pageSize" : page_size,
261
+ }
262
+ response_text = fetch(self.web_page, url, payload)
263
+ spu_list_new = response_text['info']['data']['list']
264
+ list_item += spu_list_new
265
+ time.sleep(0.1)
266
+
267
+ for item in list_item:
268
+ supplierSku = item['supplierSku']
269
+ item['cost_price'] = self.bridge.get_sku_cost(supplierSku, source)
270
+ item['sku_img'] = self.bridge.get_sku_img(supplierSku, source)
271
+
272
+ write_dict_to_file(cache_file, list_item)
273
+
274
+ return list_item
275
+
276
+ def get_replenish_list(self):
277
+ page_num = 1
278
+ page_size = 50
279
+ first_day, last_day = TimeUtils.get_last_month_range()
280
+
281
+ cache_file = f'{self.config.auto_dir}/cache/replenish_list_{self.store_username}_{first_day}_{last_day}.json'
282
+ list_item = read_dict_from_file(cache_file, 3600 * 24 * 20)
283
+ if len(list_item) > 0:
284
+ return list_item
285
+
286
+ url = f"https://sso.geiwohuo.com/gsfs/finance/selfReplenish/list"
287
+ payload = {
288
+ "page" : page_num,
289
+ "perPage" : page_size,
290
+ "tabType" : 2,
291
+ "addTimeStart": f"{first_day} 00:00:00",
292
+ "addTimeEnd" : f"{last_day} 23:59:59"
293
+ }
294
+ response_text = fetch(self.web_page, url, payload)
295
+ error_code = response_text.get('code')
296
+ if str(error_code) != '0':
297
+ raise send_exception(json.dumps(response_text, ensure_ascii=False))
298
+ list_item = response_text['info']['data']
299
+ total = response_text['info']['meta']['count']
300
+ totalPage = math.ceil(total / page_size)
301
+
302
+ for page in range(2, totalPage + 1):
303
+ log(f'获取不扣款列表 第{page}/{totalPage}页')
304
+ page_num = page
305
+ payload = {
306
+ "page" : page_num,
307
+ "perPage" : page_size,
308
+ "tabType" : 2,
309
+ "addTimeStart": f"{first_day} 00:00:00",
310
+ "addTimeEnd" : f"{last_day} 23:59:59"
311
+ }
312
+ response_text = fetch(self.web_page, url, payload)
313
+ spu_list_new = response_text['info']['data']
314
+ list_item += spu_list_new
315
+ time.sleep(0.1)
316
+
317
+ write_dict_to_file(cache_file, list_item)
318
+
319
+ return list_item
320
+
321
+ def get_return_list(self):
322
+ page_num = 1
323
+ page_size = 200
324
+ first_day, last_day = TimeUtils.get_last_month_range()
325
+
326
+ cache_file = f'{self.config.auto_dir}/cache/return_list_{self.store_username}_{first_day}_{last_day}.json'
327
+ list_item = read_dict_from_file(cache_file, 3600 * 24 * 20)
328
+ if len(list_item) > 0:
329
+ return list_item
330
+
331
+ url = f"https://sso.geiwohuo.com/pfmp/returnOrder/page"
332
+ payload = {
333
+ "addTimeStart" : f"{first_day} 00:00:00",
334
+ "addTimeEnd" : f"{last_day} 23:59:59",
335
+ "returnOrderStatusList": [4],
336
+ "page" : page_num,
337
+ "perPage" : page_size
338
+ }
339
+ response_text = fetch(self.web_page, url, payload)
340
+ error_code = response_text.get('code')
341
+ if str(error_code) != '0':
342
+ raise send_exception(json.dumps(response_text, ensure_ascii=False))
343
+
344
+ list_item = response_text['info']['data']
345
+ total = response_text['info']['meta']['count']
346
+ totalPage = math.ceil(total / page_size)
347
+
348
+ for page in range(2, totalPage + 1):
349
+ log(f'获取不扣款列表 第{page}/{totalPage}页')
350
+ page_num = page
351
+ payload = {
352
+ "addTimeStart" : f"{first_day} 00:00:00",
353
+ "addTimeEnd" : f"{last_day} 23:59:59",
354
+ "returnOrderStatusList": [4],
355
+ "page" : page_num,
356
+ "perPage" : page_size
357
+ }
358
+ response_text = fetch(self.web_page, url, payload)
359
+ spu_list_new = response_text['info']['data']
360
+ list_item += spu_list_new
361
+ time.sleep(0.1)
362
+
363
+ write_dict_to_file(cache_file, list_item)
364
+
365
+ return list_item
366
+
86
367
  def get_comment_list(self):
87
368
  cache_file = f'{self.config.auto_dir}/shein/dict/comment_list_{TimeUtils.today_date()}.json'
88
369
  comment_list = read_dict_from_file_ex(cache_file, self.store_username, 3600)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.24
3
+ Version: 1.0.25
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
@@ -1,14 +1,14 @@
1
1
  qrpa/RateLimitedSender.py,sha256=hqvb1qspDFaW4RsLuVufylOrefkMgixANKeBaGEqYb4,1421
2
- qrpa/__init__.py,sha256=-7KlqEQj8qwtMs6xAHh3JB2B-5xDBz273BeZiBQ5Fe4,953
2
+ qrpa/__init__.py,sha256=OMQjTO0rE2XDyxsM6wVeWfI1rKFyXRGO5oPU6iLqfoA,980
3
3
  qrpa/db_migrator.py,sha256=2VmhzcMsU0MKpl-mNCwKyV8tLTqyEysSpP27-S_rQZ8,21862
4
- qrpa/fun_base.py,sha256=j3sbYInaltsRItUEqt1dhqsijdjvkePV4X4aN34madg,4410
5
- qrpa/fun_excel.py,sha256=o6Tb_lp3uFc0MpS6NG6N6CTrgUwRABTTHyVY2eMTYDA,105676
4
+ qrpa/fun_base.py,sha256=qg6SvR-GEj2TclB1OL9eLu711jV-bysXJ5Eh2gW9pE8,10600
5
+ qrpa/fun_excel.py,sha256=rMfNsokeAwftIENOYTGaN3-bRj1v9-TpArFUtnkK1kU,106477
6
6
  qrpa/fun_file.py,sha256=yzjDV16WL5vRys7J4uQcNzIFkX4D5MAlSCwxcD-mwQo,11966
7
7
  qrpa/fun_web.py,sha256=5QLQorAhRzMOGMRh4eCJ2UH8ZhVHvxkHwobWhmgU5qM,6286
8
8
  qrpa/fun_win.py,sha256=-LnTeocdTt72NVH6VgLdpAT9_C5oV9okeudXG6CftMA,8034
9
9
  qrpa/shein_daily_report_model.py,sha256=H8oZmIN5Pyqe306W1_xuz87lOqLQ_LI5RjXbaxDkIzE,12589
10
- qrpa/shein_excel.py,sha256=7gFAh7etQB9ChoXZkqPD3fEQA0Y3sm_Ja6UtD_DkfSo,38472
11
- qrpa/shein_lib.py,sha256=ub0jv9P4Nt8S_DQ77uIQBCULGDWYrkzjwsmPhlUkKq8,85266
10
+ qrpa/shein_excel.py,sha256=sRbUsEkFeQVGYsmhtK6nNaoSLdS0jLrm2bffhtQfFks,101399
11
+ qrpa/shein_lib.py,sha256=aAyK4ENbI_cqLAS2GvNIgbeyRkjAiJn1y_A1C-0M-Dg,96872
12
12
  qrpa/shein_sqlite.py,sha256=ZQwD0Gz81q9WY7tY2HMEYvSF9r3N_G_Aur3bYfST9WY,5707
13
13
  qrpa/shein_ziniao.py,sha256=nSqqcEPh4nVQtUxUnIRzeZfTLyXywGPjPZn5pP-w57U,18309
14
14
  qrpa/temu_chrome.py,sha256=CbtFy1QPan9xJdJcNZj-EsVGhUvv3ZTEPVDEA4-im40,2803
@@ -17,7 +17,7 @@ qrpa/temu_lib.py,sha256=hYB59zsLS3m3NTic_duTwPMOTSxlHyQVa8OhHnHm-1g,7199
17
17
  qrpa/time_utils.py,sha256=ef0hhbN_6b-gcnz5ETIVOoxemIMvcxGVGGIRnHnGaBo,29564
18
18
  qrpa/time_utils_example.py,sha256=shHOXKKF3QSzb0SHsNc34M61wEkkLuM30U9X1THKNS8,8053
19
19
  qrpa/wxwork.py,sha256=Vy8PGEtlTWt4-1laVhuqpJUGCFH2JymgbjvH00aaBog,10946
20
- qrpa-1.0.24.dist-info/METADATA,sha256=IUf28BbfVg7_crICn1PvAHv6u_xeOQljmoDtKk_sccg,231
21
- qrpa-1.0.24.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
- qrpa-1.0.24.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
23
- qrpa-1.0.24.dist-info/RECORD,,
20
+ qrpa-1.0.25.dist-info/METADATA,sha256=EQUAQAlLv1qCtr78NOCVbwHkyqNKUbYnQkOWZaXFpc8,231
21
+ qrpa-1.0.25.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
22
+ qrpa-1.0.25.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
23
+ qrpa-1.0.25.dist-info/RECORD,,
File without changes