qrpa 1.0.49__tar.gz → 1.0.51__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.
- {qrpa-1.0.49 → qrpa-1.0.51}/PKG-INFO +1 -1
- {qrpa-1.0.49 → qrpa-1.0.51}/pyproject.toml +1 -1
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/shein_lib.py +40 -20
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/shein_ziniao.py +1 -1
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa.egg-info/PKG-INFO +1 -1
- {qrpa-1.0.49 → qrpa-1.0.51}/README.md +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/RateLimitedSender.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/__init__.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/db_migrator.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/feishu_bot_app.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/feishu_client.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/feishu_logic.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/fun_base.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/fun_excel.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/fun_file.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/fun_web.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/fun_win.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/mysql_module/__init__.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/mysql_module/shein_return_order_model.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/shein_daily_report_model.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/shein_excel.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/shein_mysql.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/shein_sqlite.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/temu_chrome.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/temu_excel.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/temu_lib.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/time_utils.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/time_utils_example.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa/wxwork.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa.egg-info/SOURCES.txt +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa.egg-info/dependency_links.txt +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/qrpa.egg-info/top_level.txt +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/setup.cfg +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/setup.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/tests/test_db_migrator.py +0 -0
- {qrpa-1.0.49 → qrpa-1.0.51}/tests/test_wxwork.py +0 -0
|
@@ -8,7 +8,7 @@ from .shein_sqlite import insert_sales, get_last_week_sales, get_near_week_sales
|
|
|
8
8
|
|
|
9
9
|
import math
|
|
10
10
|
import time
|
|
11
|
-
import json
|
|
11
|
+
import json, traceback
|
|
12
12
|
from datetime import datetime
|
|
13
13
|
from playwright.sync_api import Page
|
|
14
14
|
|
|
@@ -47,10 +47,11 @@ class SheinLib:
|
|
|
47
47
|
while not web_page.locator('//div[contains(text(),"商家后台")]').nth(1).is_visible():
|
|
48
48
|
|
|
49
49
|
if web_page.locator('xpath=//div[@id="container" and @alita-name="gmpsso"]//button[@type="button" and @id]').nth(0).is_visible():
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
if 'https://sso.geiwohuo.com/#/home' not in web_page.url:
|
|
51
|
+
log("鉴权确定按钮可见 点击'确定'按钮", self.store_username, self.store_name)
|
|
52
|
+
web_page.locator('xpath=//div[@id="container" and @alita-name="gmpsso"]//button[@type="button" and @id]').nth(0).click()
|
|
53
|
+
web_page.wait_for_load_state("load")
|
|
54
|
+
web_page.wait_for_timeout(1000)
|
|
54
55
|
|
|
55
56
|
while web_page.locator('//div[text()="验证码"]').is_visible():
|
|
56
57
|
log(f'等待输入验证码: {wait_count}', self.store_username, self.store_name)
|
|
@@ -67,7 +68,7 @@ class SheinLib:
|
|
|
67
68
|
web_page.wait_for_timeout(5000)
|
|
68
69
|
log('点击"登录"', self.store_username, self.store_name)
|
|
69
70
|
web_page.locator('//button[contains(@class,"login_btn")]').click()
|
|
70
|
-
|
|
71
|
+
|
|
71
72
|
log('再延时5秒', self.store_username, self.store_name)
|
|
72
73
|
web_page.wait_for_timeout(5000)
|
|
73
74
|
|
|
@@ -81,14 +82,26 @@ class SheinLib:
|
|
|
81
82
|
|
|
82
83
|
if 'SHEIN全球商家中心' in web_page.title() and 'https://sso.geiwohuo.com/#/home' in web_page.url:
|
|
83
84
|
log('SHEIN全球商家中心 中断循环', self.store_username, self.store_name)
|
|
85
|
+
web_page.wait_for_load_state("load")
|
|
86
|
+
web_page.wait_for_timeout(1000)
|
|
87
|
+
web_page.wait_for_load_state("networkidle")
|
|
88
|
+
web_page.wait_for_timeout(1000)
|
|
84
89
|
break
|
|
85
90
|
|
|
86
91
|
if '后台首页' in web_page.title() and 'https://sso.geiwohuo.com/#/home' in web_page.url:
|
|
87
92
|
log('后台首页 中断循环', self.store_username, self.store_name)
|
|
93
|
+
web_page.wait_for_load_state("load")
|
|
94
|
+
web_page.wait_for_timeout(1000)
|
|
95
|
+
web_page.wait_for_load_state("networkidle")
|
|
96
|
+
web_page.wait_for_timeout(1000)
|
|
88
97
|
break
|
|
89
98
|
|
|
90
99
|
if '商家后台' in web_page.title() and 'https://sso.geiwohuo.com/#/home' in web_page.url:
|
|
91
100
|
log('后台首页 中断循环', self.store_username, self.store_name)
|
|
101
|
+
web_page.wait_for_load_state("load")
|
|
102
|
+
web_page.wait_for_timeout(1000)
|
|
103
|
+
web_page.wait_for_load_state("networkidle")
|
|
104
|
+
web_page.wait_for_timeout(1000)
|
|
92
105
|
break
|
|
93
106
|
|
|
94
107
|
if 'mrs.biz.sheincorp.cn' in web_page.url and '商家后台' in web_page.title():
|
|
@@ -109,12 +122,14 @@ class SheinLib:
|
|
|
109
122
|
web_page.wait_for_load_state("load")
|
|
110
123
|
web_page.wait_for_timeout(3000)
|
|
111
124
|
|
|
125
|
+
break
|
|
112
126
|
except Exception as e:
|
|
113
127
|
log(f"错误发生: {e}, 重试中...({self.store_username}, {self.store_name})")
|
|
128
|
+
log(traceback.format_exc())
|
|
114
129
|
if 'crashed' in str(e) or 'https://sso.geiwohuo.com//#/auth/SSLS' in web_page.url:
|
|
115
|
-
web_page.
|
|
130
|
+
web_page.goto('https://sso.geiwohuo.com')
|
|
116
131
|
web_page.wait_for_load_state('load')
|
|
117
|
-
web_page.wait_for_timeout(
|
|
132
|
+
web_page.wait_for_timeout(10000)
|
|
118
133
|
retries += 1
|
|
119
134
|
if retries >= MAX_RETRIES:
|
|
120
135
|
log(f"达到最大重试次数,停止尝试({self.store_username}, {self.store_name})")
|
|
@@ -122,6 +137,9 @@ class SheinLib:
|
|
|
122
137
|
time.sleep(2) # 错误时等待2秒后重试
|
|
123
138
|
|
|
124
139
|
log('鉴权处理结束')
|
|
140
|
+
# web_page.wait_for_load_state("load")
|
|
141
|
+
# web_page.wait_for_load_state("networkidle")
|
|
142
|
+
web_page.wait_for_timeout(3000)
|
|
125
143
|
|
|
126
144
|
# 获取质检报告pdf地址
|
|
127
145
|
def get_qc_report_url(self, deliverCode, purchaseCode):
|
|
@@ -229,27 +247,29 @@ class SheinLib:
|
|
|
229
247
|
has_valid_package = item.get('hasPackage') == 1
|
|
230
248
|
is_valid_yesterday = TimeUtils.is_yesterday(item['completeTime'], None) if item.get('completeTime') else False
|
|
231
249
|
returnOrderId = item['id']
|
|
232
|
-
return_box_detail =
|
|
250
|
+
item['return_box_detail'] = []
|
|
233
251
|
item['qc_report_url'] = ''
|
|
234
252
|
item['report_url'] = ''
|
|
235
253
|
item['store_username'] = self.store_username
|
|
236
254
|
item['store_name'] = self.store_name
|
|
237
255
|
item['store_manager'] = self.config.shein_store_manager.get(str(self.store_username).lower())
|
|
238
|
-
if has_valid_package
|
|
256
|
+
if has_valid_package:
|
|
257
|
+
return_box_detail = self.get_return_order_box_detail(returnOrderId)
|
|
258
|
+
if len(return_box_detail) > 0:
|
|
239
259
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
260
|
+
if int(item['returnScrapType']) == 1:
|
|
261
|
+
purchaseCode = item['sellerOrderNo']
|
|
262
|
+
delivery_code = item['sellerDeliveryNo']
|
|
263
|
+
item['qc_report_url'] = self.get_qc_report_url(delivery_code, purchaseCode)
|
|
244
264
|
|
|
245
|
-
|
|
246
|
-
|
|
265
|
+
if int(item['returnScrapType']) == 2:
|
|
266
|
+
item['report_url'] = self.get_inspect_report_url(returnOrderId)
|
|
247
267
|
|
|
248
|
-
|
|
268
|
+
item['return_box_detail'] = return_box_detail
|
|
249
269
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
270
|
+
all_list_item.append(item)
|
|
271
|
+
if is_valid_yesterday:
|
|
272
|
+
today_list_item.append(item)
|
|
253
273
|
|
|
254
274
|
cache_file = f'{self.config.auto_dir}/shein/cache/shein_return_order_list_{TimeUtils.today_date()}.json'
|
|
255
275
|
write_dict_to_file_ex(cache_file, {self.store_username: today_list_item}, [self.store_username])
|
|
@@ -412,7 +412,7 @@ class ZiniaoRunner:
|
|
|
412
412
|
raise RuntimeError("店铺列表为空")
|
|
413
413
|
|
|
414
414
|
# 多线程并发执行任务
|
|
415
|
-
max_threads =
|
|
415
|
+
max_threads = 1 if (hostname().lower() == 'krrpa') else 3
|
|
416
416
|
log(f'当前启用线程数: {max_threads}')
|
|
417
417
|
self.task_manager.run_with_thread_pool(browser_list, max_threads, run, task_key, just_store_username, is_skip_store)
|
|
418
418
|
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|