qrpa 1.1.9__py3-none-any.whl → 1.1.11__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
@@ -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
  # 获取供货商信息
@@ -907,9 +907,9 @@ class SheinLib:
907
907
  write_dict_to_file(cache_file, data)
908
908
  return data
909
909
 
910
- def get_product_detail(self, spu_name):
910
+ def get_product_detail(self, spu_name, cache_interval=3600 * 24 * 7):
911
911
  cache_file = f'{self.config.auto_dir}/shein/product_detail/product_detail_{spu_name}.json'
912
- info = read_dict_from_file(cache_file, 3600 * 24 * 7)
912
+ info = read_dict_from_file(cache_file, cache_interval)
913
913
  if len(info) > 0:
914
914
  return info
915
915
 
@@ -1660,7 +1660,14 @@ class SheinLib:
1660
1660
  item["day"] = day_item["dataDate"]
1661
1661
  item["sales_num"] = day_item["saleCnt1d"]
1662
1662
  item['sales_num_inc'] = item['sales_num'] - last_item.get('sales_num', 0)
1663
- 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'])
1664
1671
  item['sales_amount_inc'] = item['sales_amount'] - float(last_item.get('sales_amount', 0))
1665
1672
  item['visitor_num'] = day_item['idxShopGoodsUv1d']
1666
1673
  item['visitor_num_inc'] = item['visitor_num'] - last_item.get('visitor_num', 0)
@@ -2239,6 +2246,23 @@ class SheinLib:
2239
2246
 
2240
2247
  return dict
2241
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
+
2242
2266
  def get_sku_price_v2(self, skc_list):
2243
2267
  log(f'获取sku价格列表', skc_list)
2244
2268
  url = "https://sso.geiwohuo.com/idms/goods-skc/price"
@@ -2797,6 +2821,10 @@ class SheinLib:
2797
2821
  raise send_exception(json.dumps(response_text, ensure_ascii=False))
2798
2822
 
2799
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)
2800
2828
 
2801
2829
  skc_list = [item['skc'] for item in spu_list]
2802
2830
  self.get_activity_label(skc_list)
@@ -2813,6 +2841,11 @@ class SheinLib:
2813
2841
  response_text = fetch(self.web_page, url, payload)
2814
2842
  spu_list_new = response_text['info']['list']
2815
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
+
2816
2849
  skc_list = [item['skc'] for item in spu_list_new]
2817
2850
  self.get_activity_label(skc_list)
2818
2851
  self.get_preemption_list(skc_list)
@@ -3069,7 +3102,7 @@ class SheinLib:
3069
3102
  page_size = 200 # 列表最多返回200条数据 大了没有用
3070
3103
 
3071
3104
  cache_file = f'{self.config.auto_dir}/shein/cache/check_order_{first_day}_{last_day}.json'
3072
- list_item = read_dict_from_file_ex(cache_file, self.store_username)
3105
+ list_item_cache = read_dict_from_file_ex(cache_file, self.store_username)
3073
3106
 
3074
3107
  url = f"https://sso.geiwohuo.com/gsfs/finance/reportOrder/dualMode/checkOrderList/item/union"
3075
3108
  payload = {
@@ -3086,9 +3119,9 @@ class SheinLib:
3086
3119
  total = response_text['info']['meta']['count']
3087
3120
  totalPage = math.ceil(total / page_size)
3088
3121
 
3089
- if int(total) == len(list_item):
3122
+ if int(total) == len(list_item_cache):
3090
3123
  log('总数与缓存数量相同 跳过剩余页抓取', total)
3091
- return list_item
3124
+ return list_item_cache
3092
3125
 
3093
3126
  for page in range(2, totalPage + 1):
3094
3127
  log(f'获取收支明细列表 第{page}/{totalPage}页')
qrpa/shein_ziniao.py CHANGED
@@ -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.9
3
+ Version: 1.1.11
4
4
  Summary: qsir's rpa library
5
5
  Author: QSir
6
6
  Author-email: QSir <1171725650@qq.com>
@@ -11,10 +11,10 @@ qrpa/fun_web.py,sha256=2aYrtRlf-p-P6AyjrlIcmMVq8oSDePEY48YLm4ZRS1A,11857
11
11
  qrpa/fun_win.py,sha256=-LnTeocdTt72NVH6VgLdpAT9_C5oV9okeudXG6CftMA,8034
12
12
  qrpa/shein_daily_report_model.py,sha256=H8oZmIN5Pyqe306W1_xuz87lOqLQ_LI5RjXbaxDkIzE,12589
13
13
  qrpa/shein_excel.py,sha256=8TYZt45BZ9e6oM2Z1G48SzUWrGpSI4Q5vBxvGm8433U,147408
14
- qrpa/shein_lib.py,sha256=LxXI0-OyP6l8bpH39Y2Jh42fmpNbtNl1il3H0sfaFnk,144530
14
+ qrpa/shein_lib.py,sha256=Na7a3WTfcbLFUYmsyPLNbwfWCqSGAPMO82Qnx9_RtAo,146101
15
15
  qrpa/shein_mysql.py,sha256=Sgz6U0_3f4cT5zPf1Ht1OjvSFhrVPLkMxt91NV-ZPCM,3005
16
16
  qrpa/shein_sqlite.py,sha256=ZQwD0Gz81q9WY7tY2HMEYvSF9r3N_G_Aur3bYfST9WY,5707
17
- qrpa/shein_ziniao.py,sha256=SyxCvi49HKbQqoz9eQP4uU3jh-blxnUjjWw-0YA0n0w,21727
17
+ qrpa/shein_ziniao.py,sha256=LSjnzGm_K6rWJX5SGhcd3J_VXVRlwL2xQXe5TDpWuBU,21727
18
18
  qrpa/temu_chrome.py,sha256=CbtFy1QPan9xJdJcNZj-EsVGhUvv3ZTEPVDEA4-im40,2803
19
19
  qrpa/temu_excel.py,sha256=2hGw76YWzkTZGyFCuuUAab4oHptYX9a6U6yjpNsL7FE,6990
20
20
  qrpa/temu_lib.py,sha256=hYB59zsLS3m3NTic_duTwPMOTSxlHyQVa8OhHnHm-1g,7199
@@ -24,7 +24,7 @@ qrpa/wxwork.py,sha256=gIytG19DZ5g7Tsl0-W3EbjfSnpIqZw-ua24gcB78YEg,11264
24
24
  qrpa/mysql_module/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
25
25
  qrpa/mysql_module/shein_product_model.py,sha256=v21_juWsZqTHj2k08GUGNkoRZ4hkKZKjaE-wmRl2a2k,19257
26
26
  qrpa/mysql_module/shein_return_order_model.py,sha256=Zt-bGOH_kCDbakW7uaTmqqo_qTT8v424yidcYSfWvWM,26562
27
- qrpa-1.1.9.dist-info/METADATA,sha256=lltJAOp-oOwOzx4t8JKE8aXZBvWHFwUsyZCukm84qs8,230
28
- qrpa-1.1.9.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
- qrpa-1.1.9.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
30
- qrpa-1.1.9.dist-info/RECORD,,
27
+ qrpa-1.1.11.dist-info/METADATA,sha256=hYkwElRCZGxhrqqltdKvN-38HLADWaROGumjbeN0Rq4,231
28
+ qrpa-1.1.11.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ qrpa-1.1.11.dist-info/top_level.txt,sha256=F6T5igi0fhXDucPPUbmmSC0qFCDEsH5eVijfVF48OFU,5
30
+ qrpa-1.1.11.dist-info/RECORD,,
File without changes