qrpa 1.1.8__tar.gz → 1.1.10__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 qrpa might be problematic. Click here for more details.

Files changed (37) hide show
  1. {qrpa-1.1.8 → qrpa-1.1.10}/PKG-INFO +1 -1
  2. {qrpa-1.1.8 → qrpa-1.1.10}/pyproject.toml +1 -1
  3. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/shein_excel.py +9 -6
  4. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/shein_lib.py +50 -16
  5. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/shein_ziniao.py +1 -1
  6. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa.egg-info/PKG-INFO +1 -1
  7. {qrpa-1.1.8 → qrpa-1.1.10}/README.md +0 -0
  8. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/RateLimitedSender.py +0 -0
  9. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/__init__.py +0 -0
  10. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/db_migrator.py +0 -0
  11. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/feishu_bot_app.py +0 -0
  12. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/feishu_client.py +0 -0
  13. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/feishu_logic.py +0 -0
  14. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/fun_base.py +0 -0
  15. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/fun_excel.py +0 -0
  16. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/fun_file.py +0 -0
  17. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/fun_web.py +0 -0
  18. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/fun_win.py +0 -0
  19. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/mysql_module/__init__.py +0 -0
  20. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/mysql_module/shein_product_model.py +0 -0
  21. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/mysql_module/shein_return_order_model.py +0 -0
  22. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/shein_daily_report_model.py +0 -0
  23. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/shein_mysql.py +0 -0
  24. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/shein_sqlite.py +0 -0
  25. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/temu_chrome.py +0 -0
  26. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/temu_excel.py +0 -0
  27. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/temu_lib.py +0 -0
  28. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/time_utils.py +0 -0
  29. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/time_utils_example.py +0 -0
  30. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa/wxwork.py +0 -0
  31. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa.egg-info/SOURCES.txt +0 -0
  32. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa.egg-info/dependency_links.txt +0 -0
  33. {qrpa-1.1.8 → qrpa-1.1.10}/qrpa.egg-info/top_level.txt +0 -0
  34. {qrpa-1.1.8 → qrpa-1.1.10}/setup.cfg +0 -0
  35. {qrpa-1.1.8 → qrpa-1.1.10}/setup.py +0 -0
  36. {qrpa-1.1.8 → qrpa-1.1.10}/tests/test_db_migrator.py +0 -0
  37. {qrpa-1.1.8 → qrpa-1.1.10}/tests/test_wxwork.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.1.8
3
+ Version: 1.1.10
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "qrpa"
7
- version = "1.1.8"
7
+ version = "1.1.10"
8
8
  description = "qsir's rpa library"
9
9
  authors = [{ name = "QSir", email = "1171725650@qq.com" }]
10
10
  readme = "README.md"
@@ -20,7 +20,7 @@ class SheinExcel:
20
20
  dict_sku_not_found = read_dict_from_file(cache_file)
21
21
 
22
22
  excel_data = []
23
- for store_username,data_list in dict_sku_not_found.items():
23
+ for store_username, data_list in dict_sku_not_found.items():
24
24
  excel_data += data_list
25
25
 
26
26
  sheet_name1 = '未匹配SKU_需运营调整'
@@ -32,7 +32,7 @@ class SheinExcel:
32
32
  cache_file = f'{self.config.auto_dir}/shein/dict/sku_to_skc.json'
33
33
  sku_to_skc = read_dict_from_file(cache_file)
34
34
  excel_data = []
35
- for store_username,data_list in sku_to_skc.items():
35
+ for store_username, data_list in sku_to_skc.items():
36
36
  excel_data += data_list
37
37
 
38
38
  sheet_name = 'sku到skc映射'
@@ -60,15 +60,18 @@ class SheinExcel:
60
60
  info = read_dict_from_file_ex(cache_file, store_username)
61
61
  return info['supplier_name']
62
62
 
63
- def write_withdraw_report_2024(self):
64
- excel_path = create_file_path(self.config.excel_withdraw_2024)
63
+ def write_withdraw_report_2024(self, year=2024):
64
+ if year == 2025:
65
+ excel_path = create_file_path(self.config.excel_withdraw_2025)
66
+ else:
67
+ excel_path = create_file_path(self.config.excel_withdraw_2024)
65
68
  dict_store = read_dict_from_file(self.config.shein_store_alias)
66
69
 
67
70
  header = ['店铺名称', '店铺账号', '供应商名称', '交易单号', '提现时间', '提现成功时间', '更新时间', '提现明细单号',
68
71
  '收款帐户', '收款帐户所在地', '净金额', '保证金', '手续费', '汇率', '收款金额', '提现状态']
69
72
  summary_excel_data = [header]
70
73
  # 先读取提现明细列表写入
71
- first_day, last_day = TimeUtils.get_year_range_time(2024)
74
+ first_day, last_day = TimeUtils.get_year_range_time(year)
72
75
  cache_file = f'{self.config.auto_dir}/shein/cache/withdraw_list_{first_day}_{last_day}.json'
73
76
  dict_withdraw = read_dict_from_file(cache_file)
74
77
  account_list = []
@@ -115,7 +118,7 @@ class SheinExcel:
115
118
  row_item.append('')
116
119
  summary_excel_data.append(row_item)
117
120
 
118
- sheet_name = '汇总2024'
121
+ sheet_name = f'汇总{year}'
119
122
 
120
123
  operations.append([sheet_name, 'write', summary_excel_data])
121
124
  operations.append([sheet_name, 'format', self.format_withdraw_2024])
@@ -26,7 +26,7 @@ class SheinLib:
26
26
  self.DictQueryTime = {}
27
27
 
28
28
  self.deal_auth()
29
- # self.get_user()
29
+ self.get_user()
30
30
 
31
31
  # 处理鉴权
32
32
  def deal_auth(self):
@@ -263,7 +263,7 @@ class SheinLib:
263
263
 
264
264
  # 特定于此请求的配置
265
265
  fetch_config = {
266
- "credentials" : "omit",
266
+ "credentials" : "include",
267
267
  "referrer" : "https://sso.geiwohuo.com/",
268
268
  "referrerPolicy": "strict-origin-when-cross-origin"
269
269
  }
@@ -273,12 +273,12 @@ class SheinLib:
273
273
  if str(error_code) != '0':
274
274
  raise send_exception(json.dumps(response_text, ensure_ascii=False))
275
275
  info = response_text.get('info', {})
276
- log(info)
277
276
  cache_file = f'{self.config.auto_dir}/shein_user.json'
278
277
  info['store_username'] = self.store_username
279
278
  info['store_name'] = self.store_name
280
279
  write_dict_to_file_ex(cache_file, {self.store_username: info}, [self.store_username])
281
-
280
+ log(info)
281
+ self.user_info = info
282
282
  return info
283
283
 
284
284
  # 获取供货商信息
@@ -303,19 +303,14 @@ class SheinLib:
303
303
 
304
304
  return info
305
305
 
306
- def get_withdraw_list(self, supplier_id, mode='month'):
306
+ def get_withdraw_list(self, supplier_id, year=0):
307
307
  self.web_page.goto('https://sso.geiwohuo.com/#/mws/seller/new-account-overview')
308
308
  self.web_page.wait_for_load_state("load")
309
309
 
310
- if mode == 'month':
310
+ if year == 0:
311
311
  first_day, last_day = TimeUtils.get_last_month_range_time()
312
312
  else:
313
- first_day, last_day = TimeUtils.get_year_range_time(2024)
314
-
315
- cache_file = f'{self.config.auto_dir}/shein/cache/withdraw_list_{first_day}_{last_day}.json'
316
- withdraw_list = read_dict_from_file_ex(cache_file, self.store_username, 3600 * 12)
317
- if len(withdraw_list) > 0:
318
- return withdraw_list
313
+ first_day, last_day = TimeUtils.get_year_range_time(year)
319
314
 
320
315
  page_num = 1
321
316
  page_size = 200
@@ -341,12 +336,18 @@ class SheinLib:
341
336
  total = response_text['info']['count']
342
337
  totalPage = math.ceil(total / page_size)
343
338
 
339
+ cache_file = f'{self.config.auto_dir}/shein/cache/withdraw_list_{first_day}_{last_day}.json'
340
+ withdraw_list_cache = read_dict_from_file_ex(cache_file, self.store_username, 3600 * 12)
341
+ if len(withdraw_list_cache) == int(total):
342
+ log('返回缓存数据: ', len(withdraw_list_cache), total)
343
+ return withdraw_list_cache
344
+
344
345
  for page in range(2, totalPage + 1):
345
346
  log(f'获取提现列表 第{page}/{totalPage}页')
346
347
  page_num = page
347
348
  payload['pageNum'] = page_num
348
349
  response_text = fetch(self.web_page, url, payload)
349
- withdraw_list = response_text['info']['list']
350
+ withdraw_list += response_text['info']['list']
350
351
  time.sleep(0.1)
351
352
 
352
353
  write_dict_to_file_ex(cache_file, {self.store_username: withdraw_list}, [self.store_username])
@@ -906,9 +907,9 @@ class SheinLib:
906
907
  write_dict_to_file(cache_file, data)
907
908
  return data
908
909
 
909
- def get_product_detail(self, spu_name):
910
+ def get_product_detail(self, spu_name, cache_interval=3600 * 24 * 7):
910
911
  cache_file = f'{self.config.auto_dir}/shein/product_detail/product_detail_{spu_name}.json'
911
- info = read_dict_from_file(cache_file, 3600 * 24 * 7)
912
+ info = read_dict_from_file(cache_file, cache_interval)
912
913
  if len(info) > 0:
913
914
  return info
914
915
 
@@ -1659,7 +1660,14 @@ class SheinLib:
1659
1660
  item["day"] = day_item["dataDate"]
1660
1661
  item["sales_num"] = day_item["saleCnt1d"]
1661
1662
  item['sales_num_inc'] = item['sales_num'] - last_item.get('sales_num', 0)
1662
- item['sales_amount'] = day_item['dealAmt1d']
1663
+
1664
+ if int(self.user_info.get('lv1CategoryId')) == 216506: # 自运营POP店
1665
+ log('gmv1d', day_item['gmv1d'])
1666
+ item['sales_amount'] = day_item['gmv1d'] if isinstance(day_item['gmv1d'], (int, float)) else 0
1667
+ else:
1668
+ item['sales_amount'] = day_item['dealAmt1d']
1669
+
1670
+ log('sales_amount', item['sales_amount'])
1663
1671
  item['sales_amount_inc'] = item['sales_amount'] - float(last_item.get('sales_amount', 0))
1664
1672
  item['visitor_num'] = day_item['idxShopGoodsUv1d']
1665
1673
  item['visitor_num_inc'] = item['visitor_num'] - last_item.get('visitor_num', 0)
@@ -2238,6 +2246,23 @@ class SheinLib:
2238
2246
 
2239
2247
  return dict
2240
2248
 
2249
+ def get_sku_price_pop(self, spu):
2250
+ pass
2251
+ log(f'获取pop sku价格列表', spu)
2252
+ info = self.get_product_detail(spu)
2253
+
2254
+ dict_sku_price_new = {}
2255
+ for skc_item in info['skc_list']:
2256
+ for sku_item in skc_item['sku_list']:
2257
+ sku = sku_item['sku_code']
2258
+ special_price = sku_item['price_info_list'][0]['special_price']
2259
+ dict_sku_price_new[sku] = special_price
2260
+
2261
+ cache_file = f'{self.config.auto_dir}/shein/sku_price/sku_price_{self.store_username}.json'
2262
+ dict_sku_price = read_dict_from_file(cache_file)
2263
+ dict_sku_price.update(dict_sku_price_new)
2264
+ write_dict_to_file(cache_file, dict_sku_price)
2265
+
2241
2266
  def get_sku_price_v2(self, skc_list):
2242
2267
  log(f'获取sku价格列表', skc_list)
2243
2268
  url = "https://sso.geiwohuo.com/idms/goods-skc/price"
@@ -2796,6 +2821,10 @@ class SheinLib:
2796
2821
  raise send_exception(json.dumps(response_text, ensure_ascii=False))
2797
2822
 
2798
2823
  spu_list = response_text['info']['list']
2824
+ # if int(self.user_info.get('lv1CategoryId')) == 216506: # 自运营POP店
2825
+ # for spu_item in spu_list:
2826
+ # spu = spu_item.get('spu')
2827
+ # self.get_sku_price_pop(spu)
2799
2828
 
2800
2829
  skc_list = [item['skc'] for item in spu_list]
2801
2830
  self.get_activity_label(skc_list)
@@ -2812,6 +2841,11 @@ class SheinLib:
2812
2841
  response_text = fetch(self.web_page, url, payload)
2813
2842
  spu_list_new = response_text['info']['list']
2814
2843
 
2844
+ # if int(self.user_info.get('lv1CategoryId')) == 216506: # 自运营POP店
2845
+ # for spu_item in spu_list:
2846
+ # spu = spu_item.get('spu')
2847
+ # self.get_product_detail(spu)
2848
+
2815
2849
  skc_list = [item['skc'] for item in spu_list_new]
2816
2850
  self.get_activity_label(skc_list)
2817
2851
  self.get_preemption_list(skc_list)
@@ -489,7 +489,7 @@ class ZiniaoRunner:
489
489
  raise RuntimeError("店铺列表为空")
490
490
 
491
491
  # 多线程并发执行任务
492
- max_threads = 3 if (hostname().lower() == 'krrpa' or hostname().lower() == 'jyrpa') else 3
492
+ max_threads = 1 if (hostname().lower() == 'krrpa' or hostname().lower() == 'jyrpa') else 3
493
493
  log(f'当前启用线程数: {max_threads}')
494
494
  self.task_manager.run_with_thread_pool(browser_list, max_threads, run, task_key, just_store_username, is_skip_store)
495
495
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.1.8
3
+ Version: 1.1.10
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes