qrpa 1.0.92__tar.gz → 1.0.93__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.92 → qrpa-1.0.93}/PKG-INFO +1 -1
- {qrpa-1.0.92 → qrpa-1.0.93}/pyproject.toml +1 -1
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/fun_excel.py +15 -40
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa.egg-info/PKG-INFO +1 -1
- {qrpa-1.0.92 → qrpa-1.0.93}/README.md +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/RateLimitedSender.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/__init__.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/db_migrator.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/feishu_bot_app.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/feishu_client.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/feishu_logic.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/fun_base.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/fun_file.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/fun_web.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/fun_win.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/mysql_module/__init__.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/mysql_module/shein_product_model.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/mysql_module/shein_return_order_model.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/shein_daily_report_model.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/shein_excel.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/shein_lib.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/shein_mysql.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/shein_sqlite.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/shein_ziniao.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/temu_chrome.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/temu_excel.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/temu_lib.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/time_utils.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/time_utils_example.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa/wxwork.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa.egg-info/SOURCES.txt +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa.egg-info/dependency_links.txt +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/qrpa.egg-info/top_level.txt +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/setup.cfg +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/setup.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/tests/test_db_migrator.py +0 -0
- {qrpa-1.0.92 → qrpa-1.0.93}/tests/test_wxwork.py +0 -0
|
@@ -759,49 +759,24 @@ def download_images_concurrently(image_urls, platform='shein', img_save_dir=None
|
|
|
759
759
|
results = list(executor.map(lambda url: download_img_v2(url, platform, img_save_path=img_save_dir), image_urls))
|
|
760
760
|
return results
|
|
761
761
|
|
|
762
|
-
def get_chromium_executable():
|
|
763
|
-
"""
|
|
764
|
-
返回 Chromium 可执行文件路径,兼容 PyInstaller 打包后的 exe
|
|
765
|
-
"""
|
|
766
|
-
# PyInstaller 临时目录
|
|
767
|
-
if getattr(sys, 'frozen', False):
|
|
768
|
-
base_path = Path(sys._MEIPASS)
|
|
769
|
-
else:
|
|
770
|
-
base_path = Path(__file__).parent
|
|
771
|
-
|
|
772
|
-
# 尝试查找打包后的浏览器文件
|
|
773
|
-
possible_path = base_path / "playwright" / "driver" / "package" / "chromium_headless_shell-1169" / "chrome-win" / "headless_shell.exe"
|
|
774
|
-
if possible_path.exists():
|
|
775
|
-
return str(possible_path)
|
|
776
|
-
|
|
777
|
-
# fallback: 系统 Playwright 安装目录
|
|
778
|
-
local_appdata = Path(os.environ.get("LOCALAPPDATA", ""))
|
|
779
|
-
fallback_path = local_appdata / "ms-playwright" / "chromium" / "chrome-win" / "chrome.exe"
|
|
780
|
-
if fallback_path.exists():
|
|
781
|
-
return str(fallback_path)
|
|
782
|
-
|
|
783
|
-
raise FileNotFoundError("Chromium 可执行文件未找到,请先执行 'playwright install' 下载浏览器。")
|
|
784
|
-
|
|
785
762
|
def download_img_by_chrome(image_url, save_name):
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
763
|
+
try:
|
|
764
|
+
with sync_playwright() as p:
|
|
765
|
+
browser = p.chromium.launch(headless=True, executable_path=chromium_path) # 运行时可以看到浏览器
|
|
766
|
+
context = browser.new_context()
|
|
767
|
+
page = context.new_page()
|
|
768
|
+
# 直接通过Playwright下载图片
|
|
769
|
+
response = page.request.get(image_url)
|
|
770
|
+
with open(save_name, 'wb') as f:
|
|
771
|
+
f.write(response.body()) # 将下载的内容保存为文件
|
|
772
|
+
log(f"图片已通过chrome下载并保存为:{save_name}")
|
|
773
|
+
# 关闭浏览器
|
|
774
|
+
browser.close()
|
|
775
|
+
return save_name
|
|
776
|
+
except:
|
|
777
|
+
send_exception()
|
|
790
778
|
return None
|
|
791
779
|
|
|
792
|
-
with sync_playwright() as p:
|
|
793
|
-
browser = p.chromium.launch(headless=True, executable_path=chromium_path) # 运行时可以看到浏览器
|
|
794
|
-
context = browser.new_context()
|
|
795
|
-
page = context.new_page()
|
|
796
|
-
# 直接通过Playwright下载图片
|
|
797
|
-
response = page.request.get(image_url)
|
|
798
|
-
with open(save_name, 'wb') as f:
|
|
799
|
-
f.write(response.body()) # 将下载的内容保存为文件
|
|
800
|
-
log(f"图片已通过chrome下载并保存为:{save_name}")
|
|
801
|
-
# 关闭浏览器
|
|
802
|
-
browser.close()
|
|
803
|
-
return save_name
|
|
804
|
-
|
|
805
780
|
def download_img_v2(image_url, platform='shein', img_save_path=None):
|
|
806
781
|
image_url = add_https(image_url)
|
|
807
782
|
if image_url is None or 'http' not in image_url:
|
|
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
|
|
File without changes
|
|
File without changes
|