qrpa 1.0.34__py3-none-any.whl → 1.1.50__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.
- qrpa/RateLimitedSender.py +45 -45
- qrpa/__init__.py +31 -26
- qrpa/db_migrator.py +600 -600
- qrpa/feishu_bot_app.py +267 -267
- qrpa/feishu_client.py +410 -0
- qrpa/feishu_logic.py +1443 -0
- qrpa/fun_base.py +339 -337
- qrpa/fun_excel.py +529 -61
- qrpa/fun_file.py +318 -318
- qrpa/fun_web.py +258 -148
- qrpa/fun_win.py +198 -198
- qrpa/mysql_module/__init__.py +0 -0
- qrpa/mysql_module/new_product_analysis_model.py +556 -0
- qrpa/mysql_module/shein_ledger_model.py +468 -0
- qrpa/mysql_module/shein_product_model.py +495 -0
- qrpa/mysql_module/shein_return_order_model.py +569 -0
- qrpa/mysql_module/shein_store_model.py +595 -0
- qrpa/shein_daily_report_model.py +375 -375
- qrpa/shein_excel.py +1248 -109
- qrpa/shein_lib.py +2333 -143
- qrpa/shein_mysql.py +92 -0
- qrpa/shein_sqlite.py +153 -153
- qrpa/shein_ziniao.py +529 -450
- qrpa/temu_chrome.py +56 -56
- qrpa/temu_excel.py +139 -139
- qrpa/temu_lib.py +156 -154
- qrpa/time_utils.py +87 -50
- qrpa/time_utils_example.py +243 -243
- qrpa/wxwork.py +318 -318
- {qrpa-1.0.34.dist-info → qrpa-1.1.50.dist-info}/METADATA +1 -1
- qrpa-1.1.50.dist-info/RECORD +33 -0
- qrpa-1.0.34.dist-info/RECORD +0 -24
- {qrpa-1.0.34.dist-info → qrpa-1.1.50.dist-info}/WHEEL +0 -0
- {qrpa-1.0.34.dist-info → qrpa-1.1.50.dist-info}/top_level.txt +0 -0
qrpa/RateLimitedSender.py
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
import os
|
|
2
|
-
import time
|
|
3
|
-
import threading
|
|
4
|
-
from collections import deque
|
|
5
|
-
from datetime import datetime
|
|
6
|
-
import traceback
|
|
7
|
-
|
|
8
|
-
class RateLimitedSender:
|
|
9
|
-
def __init__(self, sender_func, interval=60):
|
|
10
|
-
"""
|
|
11
|
-
:param sender_func: 实际的发送函数,参数是字符串消息
|
|
12
|
-
:param interval: 最短发送间隔(秒)
|
|
13
|
-
"""
|
|
14
|
-
self.sender_func = sender_func
|
|
15
|
-
self.interval = interval
|
|
16
|
-
self.queue = deque()
|
|
17
|
-
self.lock = threading.Lock()
|
|
18
|
-
self.last_send_time = 0
|
|
19
|
-
|
|
20
|
-
self.thread = threading.Thread(target=self._worker, daemon=True)
|
|
21
|
-
self.thread.start()
|
|
22
|
-
|
|
23
|
-
def send(self, message):
|
|
24
|
-
"""添加消息到队列(非阻塞)"""
|
|
25
|
-
with self.lock:
|
|
26
|
-
self.queue.append(message)
|
|
27
|
-
|
|
28
|
-
def _flush(self):
|
|
29
|
-
"""立即发送队列消息(内部调用)"""
|
|
30
|
-
if not self.queue:
|
|
31
|
-
return
|
|
32
|
-
batch_message = "\n---\n".join(self.queue)
|
|
33
|
-
self.queue.clear()
|
|
34
|
-
try:
|
|
35
|
-
self.sender_func(batch_message)
|
|
36
|
-
except Exception as e:
|
|
37
|
-
print(f"[RateLimitedSender] 发送失败: {e}")
|
|
38
|
-
self.last_send_time = time.time()
|
|
39
|
-
|
|
40
|
-
def _worker(self):
|
|
41
|
-
while True:
|
|
42
|
-
with self.lock:
|
|
43
|
-
if self.queue and (time.time() - self.last_send_time >= self.interval):
|
|
44
|
-
self._flush()
|
|
45
|
-
time.sleep(1)
|
|
1
|
+
import os
|
|
2
|
+
import time
|
|
3
|
+
import threading
|
|
4
|
+
from collections import deque
|
|
5
|
+
from datetime import datetime
|
|
6
|
+
import traceback
|
|
7
|
+
|
|
8
|
+
class RateLimitedSender:
|
|
9
|
+
def __init__(self, sender_func, interval=60):
|
|
10
|
+
"""
|
|
11
|
+
:param sender_func: 实际的发送函数,参数是字符串消息
|
|
12
|
+
:param interval: 最短发送间隔(秒)
|
|
13
|
+
"""
|
|
14
|
+
self.sender_func = sender_func
|
|
15
|
+
self.interval = interval
|
|
16
|
+
self.queue = deque()
|
|
17
|
+
self.lock = threading.Lock()
|
|
18
|
+
self.last_send_time = 0
|
|
19
|
+
|
|
20
|
+
self.thread = threading.Thread(target=self._worker, daemon=True)
|
|
21
|
+
self.thread.start()
|
|
22
|
+
|
|
23
|
+
def send(self, message):
|
|
24
|
+
"""添加消息到队列(非阻塞)"""
|
|
25
|
+
with self.lock:
|
|
26
|
+
self.queue.append(message)
|
|
27
|
+
|
|
28
|
+
def _flush(self):
|
|
29
|
+
"""立即发送队列消息(内部调用)"""
|
|
30
|
+
if not self.queue:
|
|
31
|
+
return
|
|
32
|
+
batch_message = "\n---\n".join(self.queue)
|
|
33
|
+
self.queue.clear()
|
|
34
|
+
try:
|
|
35
|
+
self.sender_func(batch_message)
|
|
36
|
+
except Exception as e:
|
|
37
|
+
print(f"[RateLimitedSender] 发送失败: {e}")
|
|
38
|
+
self.last_send_time = time.time()
|
|
39
|
+
|
|
40
|
+
def _worker(self):
|
|
41
|
+
while True:
|
|
42
|
+
with self.lock:
|
|
43
|
+
if self.queue and (time.time() - self.last_send_time >= self.interval):
|
|
44
|
+
self._flush()
|
|
45
|
+
time.sleep(1)
|
qrpa/__init__.py
CHANGED
|
@@ -1,26 +1,31 @@
|
|
|
1
|
-
from .wxwork import WxWorkBot, WxWorkAppBot
|
|
2
|
-
from .feishu_bot_app import FeishuBot
|
|
3
|
-
from .db_migrator import DatabaseMigrator, DatabaseConfig, RemoteConfig, create_default_migrator
|
|
4
|
-
|
|
5
|
-
from .shein_ziniao import ZiniaoRunner
|
|
6
|
-
|
|
7
|
-
# from .fun_base import log, send_exception, md5_string, hostname, get_safe_value, sanitize_filename, get_file_size, calculate_star_symbols
|
|
8
|
-
from .fun_base import *
|
|
9
|
-
|
|
10
|
-
from .time_utils import TimeUtils
|
|
11
|
-
|
|
12
|
-
from .fun_file import read_dict_from_file, read_dict_from_file_ex, write_dict_to_file, write_dict_to_file_ex
|
|
13
|
-
from .fun_file import get_progress_json_ex, check_progress_json_ex, done_progress_json_ex
|
|
14
|
-
from .fun_file import delete_file, delete_file_simple
|
|
15
|
-
|
|
16
|
-
from .fun_web import fetch, fetch_via_iframe, find_all_iframe, full_screen_shot
|
|
17
|
-
from .fun_win import *
|
|
18
|
-
|
|
19
|
-
from .shein_excel import SheinExcel
|
|
20
|
-
from .shein_lib import SheinLib
|
|
21
|
-
|
|
22
|
-
from .fun_excel import InsertImageV2
|
|
23
|
-
|
|
24
|
-
from .temu_lib import TemuLib
|
|
25
|
-
from .temu_excel import TemuExcel
|
|
26
|
-
from .temu_chrome import temu_chrome_excute
|
|
1
|
+
from .wxwork import WxWorkBot, WxWorkAppBot
|
|
2
|
+
from .feishu_bot_app import FeishuBot
|
|
3
|
+
from .db_migrator import DatabaseMigrator, DatabaseConfig, RemoteConfig, create_default_migrator
|
|
4
|
+
|
|
5
|
+
from .shein_ziniao import ZiniaoRunner
|
|
6
|
+
|
|
7
|
+
# from .fun_base import log, send_exception, md5_string, hostname, get_safe_value, sanitize_filename, get_file_size, calculate_star_symbols
|
|
8
|
+
from .fun_base import *
|
|
9
|
+
|
|
10
|
+
from .time_utils import TimeUtils
|
|
11
|
+
|
|
12
|
+
from .fun_file import read_dict_from_file, read_dict_from_file_ex, write_dict_to_file, write_dict_to_file_ex
|
|
13
|
+
from .fun_file import get_progress_json_ex, check_progress_json_ex, done_progress_json_ex
|
|
14
|
+
from .fun_file import delete_file, delete_file_simple
|
|
15
|
+
|
|
16
|
+
from .fun_web import fetch, fetch_via_iframe, find_all_iframe, full_screen_shot
|
|
17
|
+
from .fun_win import *
|
|
18
|
+
|
|
19
|
+
from .shein_excel import SheinExcel
|
|
20
|
+
from .shein_lib import SheinLib
|
|
21
|
+
|
|
22
|
+
from .fun_excel import InsertImageV2
|
|
23
|
+
|
|
24
|
+
from .temu_lib import TemuLib
|
|
25
|
+
from .temu_excel import TemuExcel
|
|
26
|
+
from .temu_chrome import temu_chrome_excute
|
|
27
|
+
|
|
28
|
+
from .feishu_logic import FeishuBusinessLogic
|
|
29
|
+
from .feishu_client import FeishuClient
|
|
30
|
+
|
|
31
|
+
from .shein_mysql import SheinMysql
|