qrpa 1.0.51__tar.gz → 1.0.52__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 (36) hide show
  1. {qrpa-1.0.51 → qrpa-1.0.52}/PKG-INFO +1 -1
  2. {qrpa-1.0.51 → qrpa-1.0.52}/pyproject.toml +1 -1
  3. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/fun_base.py +6 -9
  4. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/shein_lib.py +7 -23
  5. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/shein_ziniao.py +9 -3
  6. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa.egg-info/PKG-INFO +1 -1
  7. {qrpa-1.0.51 → qrpa-1.0.52}/README.md +0 -0
  8. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/RateLimitedSender.py +0 -0
  9. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/__init__.py +0 -0
  10. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/db_migrator.py +0 -0
  11. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/feishu_bot_app.py +0 -0
  12. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/feishu_client.py +0 -0
  13. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/feishu_logic.py +0 -0
  14. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/fun_excel.py +0 -0
  15. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/fun_file.py +0 -0
  16. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/fun_web.py +0 -0
  17. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/fun_win.py +0 -0
  18. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/mysql_module/__init__.py +0 -0
  19. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/mysql_module/shein_return_order_model.py +0 -0
  20. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/shein_daily_report_model.py +0 -0
  21. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/shein_excel.py +0 -0
  22. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/shein_mysql.py +0 -0
  23. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/shein_sqlite.py +0 -0
  24. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/temu_chrome.py +0 -0
  25. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/temu_excel.py +0 -0
  26. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/temu_lib.py +0 -0
  27. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/time_utils.py +0 -0
  28. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/time_utils_example.py +0 -0
  29. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa/wxwork.py +0 -0
  30. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa.egg-info/SOURCES.txt +0 -0
  31. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa.egg-info/dependency_links.txt +0 -0
  32. {qrpa-1.0.51 → qrpa-1.0.52}/qrpa.egg-info/top_level.txt +0 -0
  33. {qrpa-1.0.51 → qrpa-1.0.52}/setup.cfg +0 -0
  34. {qrpa-1.0.51 → qrpa-1.0.52}/setup.py +0 -0
  35. {qrpa-1.0.51 → qrpa-1.0.52}/tests/test_db_migrator.py +0 -0
  36. {qrpa-1.0.51 → qrpa-1.0.52}/tests/test_wxwork.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.51
3
+ Version: 1.0.52
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.0.51"
7
+ version = "1.0.52"
8
8
  description = "qsir's rpa library"
9
9
  authors = [{ name = "QSir", email = "1171725650@qq.com" }]
10
10
  readme = "README.md"
@@ -13,6 +13,11 @@ from .RateLimitedSender import RateLimitedSender
13
13
 
14
14
  from typing import TypedDict
15
15
 
16
+ # 自定义错误类型,继承自 Exception
17
+ class NetWorkIdleTimeout(Exception):
18
+ """这是一个自定义错误类型"""
19
+ pass
20
+
16
21
  # 定义一个 TypedDict 来提供配置结构的类型提示
17
22
 
18
23
  class ZiNiao(TypedDict):
@@ -161,7 +166,6 @@ def remove_columns(matrix, indices):
161
166
  # 遍历每行,只保留不在indices中的列
162
167
  return [[row[i] for i in indices_to_keep] for row in matrix]
163
168
 
164
-
165
169
  def filter_columns(matrix, indices):
166
170
  """
167
171
  过滤二维列表,只保留指定索引的列
@@ -182,7 +186,6 @@ def filter_columns(matrix, indices):
182
186
  # 将过滤后的列转回二维列表
183
187
  return [list(row) for row in zip(*filtered_columns)]
184
188
 
185
-
186
189
  # # 示例使用
187
190
  # matrix = [
188
191
  # [1, 2, 3, 4],
@@ -216,7 +219,6 @@ def add_column_to_2d_list(data, new_col, index=None):
216
219
  new_data.append(row)
217
220
  return new_data
218
221
 
219
-
220
222
  def add_prefixed_column(data, header, value):
221
223
  """
222
224
  给二维列表增加第一列,第一行为 header,后面为 value。
@@ -232,7 +234,6 @@ def add_prefixed_column(data, header, value):
232
234
  new_col = [header] + [value] * (len(data) - 1)
233
235
  return [[new_col[i]] + row for i, row in enumerate(data)]
234
236
 
235
-
236
237
  def add_suffixed_column(data, header, value):
237
238
  """
238
239
  给二维列表增加第一列,第一行为 header,后面为 value。
@@ -248,7 +249,6 @@ def add_suffixed_column(data, header, value):
248
249
  new_col = [header] + [value] * (len(data) - 1)
249
250
  return [row + [new_col[i]] for i, row in enumerate(data)]
250
251
 
251
-
252
252
  def merge_2d_lists_keep_first_header(data1, data2):
253
253
  """
254
254
  合并两个二维列表,只保留第一个列表的标题(即第一行)。
@@ -268,7 +268,6 @@ def merge_2d_lists_keep_first_header(data1, data2):
268
268
 
269
269
  return [header] + rows1 + rows2
270
270
 
271
-
272
271
  def insert_total_row(data, row_index=1, label="合计"):
273
272
  """
274
273
  在指定行插入一行,第一列为 label,其余为空字符串。
@@ -286,7 +285,6 @@ def insert_total_row(data, row_index=1, label="合计"):
286
285
 
287
286
  return data[:row_index] + [new_row] + data[row_index:]
288
287
 
289
-
290
288
  def insert_empty_column_after(data, col_index, new_header="单价成本"):
291
289
  """
292
290
  在二维列表中指定列的后面插入一个新列,标题为 new_header,其余内容为空字符串。
@@ -308,7 +306,6 @@ def insert_empty_column_after(data, col_index, new_header="单价成本"):
308
306
 
309
307
  return new_data
310
308
 
311
-
312
309
  def insert_empty_column_after_column_name(data, target_col_name, new_header="单价成本"):
313
310
  """
314
311
  在指定列名对应的列后面插入一个新列,标题为 new_header,其余行为空字符串。
@@ -334,4 +331,4 @@ def insert_empty_column_after_column_name(data, target_col_name, new_header="单
334
331
  row.insert(col_index + 1, insert_value)
335
332
  new_data.append(row)
336
333
 
337
- return new_data
334
+ return new_data
@@ -1,5 +1,5 @@
1
1
  from .fun_file import read_dict_from_file, write_dict_to_file, read_dict_from_file_ex, write_dict_to_file_ex
2
- from .fun_base import log, send_exception, md5_string, get_safe_value
2
+ from .fun_base import log, send_exception, md5_string, get_safe_value, NetWorkIdleTimeout
3
3
  from .fun_web import fetch, full_screen_shot
4
4
  from .time_utils import TimeUtils
5
5
  from .wxwork import WxWorkBot
@@ -80,29 +80,13 @@ class SheinLib:
80
80
  web_page.wait_for_load_state("load")
81
81
  web_page.wait_for_timeout(1000)
82
82
 
83
- if 'SHEIN全球商家中心' in web_page.title() and 'https://sso.geiwohuo.com/#/home' in web_page.url:
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)
89
- break
90
-
91
- if '后台首页' in web_page.title() and 'https://sso.geiwohuo.com/#/home' in web_page.url:
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)
97
- break
83
+ if 'https://sso.geiwohuo.com/#/home' in web_page.url:
98
84
 
99
- if '商家后台' in web_page.title() and 'https://sso.geiwohuo.com/#/home' in web_page.url:
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)
105
- break
85
+ if 'SHEIN全球商家中心' in web_page.title() or '后台首页' in web_page.title() or '商家后台' in web_page.title():
86
+ log(web_page.title(), '中断循环', self.store_username, self.store_name)
87
+ web_page.wait_for_load_state("load")
88
+ web_page.wait_for_timeout(2000)
89
+ break
106
90
 
107
91
  if 'mrs.biz.sheincorp.cn' in web_page.url and '商家后台' in web_page.title():
108
92
  web_page.goto('https://sso.geiwohuo.com/#/home')
@@ -21,7 +21,7 @@ from playwright.sync_api import TimeoutError as PlaywrightTimeoutError
21
21
  from functools import partial
22
22
 
23
23
  from .fun_win import find_software_install_path
24
- from .fun_base import log, hostname, send_exception
24
+ from .fun_base import log, hostname, send_exception, NetWorkIdleTimeout
25
25
  from .fun_file import check_progress_json_ex, get_progress_json_ex, done_progress_json_ex, write_dict_to_file_ex
26
26
 
27
27
  class ZiniaoClient:
@@ -260,7 +260,6 @@ class ZiniaoBrowser:
260
260
  page.goto(launcher_page)
261
261
  page.wait_for_load_state('load')
262
262
 
263
- # 业务逻辑
264
263
  run_func(page, store_username, store_name, task_key)
265
264
 
266
265
  # 标记完成
@@ -332,7 +331,14 @@ class ZiniaoTaskManager:
332
331
  ip_usable = self.browser.open_ip_check(browser_context, ip_check_url)
333
332
  if ip_usable:
334
333
  print("ip检测通过,打开店铺平台主页")
335
- self.browser.open_launcher_page(browser_context, ret_json.get("launcherPage"), store_username, store_name, run_func, task_key)
334
+ # 业务逻辑
335
+ try:
336
+ self.browser.open_launcher_page(browser_context, ret_json.get("launcherPage"), store_username, store_name, run_func, task_key)
337
+ except NetWorkIdleTimeout:
338
+ log('捕获到自定义错误: NetWorkIdleTimeout')
339
+ self.browser.close_store(store_id)
340
+ pass
341
+
336
342
  else:
337
343
  print("ip检测不通过,请检查")
338
344
  except:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: qrpa
3
- Version: 1.0.51
3
+ Version: 1.0.52
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