mdbq 4.0.75__tar.gz → 4.0.76__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.
- {mdbq-4.0.75 → mdbq-4.0.76}/PKG-INFO +1 -1
- mdbq-4.0.76/mdbq/__version__.py +1 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/selenium/get_driver.py +15 -4
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq.egg-info/PKG-INFO +1 -1
- mdbq-4.0.75/mdbq/__version__.py +0 -1
- {mdbq-4.0.75 → mdbq-4.0.76}/README.txt +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/log/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/log/mylogger.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/myconf/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/myconf/myconf.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/mysql/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/mysql/deduplicator.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/mysql/mysql.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/mysql/s_query.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/mysql/unique_.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/mysql/uploader.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/other/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/other/download_sku_picture.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/other/error_handler.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/other/otk.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/other/pov_city.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/other/ua_sj.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/pbix/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/pbix/pbix_refresh.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/pbix/refresh_all.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/redis/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/redis/getredis.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/selenium/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq/spider/__init__.py +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq.egg-info/SOURCES.txt +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq.egg-info/dependency_links.txt +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/mdbq.egg-info/top_level.txt +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/setup.cfg +0 -0
- {mdbq-4.0.75 → mdbq-4.0.76}/setup.py +0 -0
@@ -0,0 +1 @@
|
|
1
|
+
VERSION = '4.0.76'
|
@@ -2,7 +2,11 @@
|
|
2
2
|
import os
|
3
3
|
import platform
|
4
4
|
import getpass
|
5
|
-
from selenium import webdriver
|
5
|
+
from selenium import webdriver as selenium_webdriver
|
6
|
+
try:
|
7
|
+
from seleniumwire import webdriver as wire_webdriver
|
8
|
+
except ImportError:
|
9
|
+
wire_webdriver = None
|
6
10
|
from selenium.webdriver.chrome.service import Service
|
7
11
|
import re
|
8
12
|
import socket
|
@@ -24,7 +28,7 @@ class GetDriver:
|
|
24
28
|
Selenium ChromeDriver 管理器,支持多平台、代理、无头模式、下载目录、User-Agent等高级配置。
|
25
29
|
支持上下文管理器(with语法),自动资源清理。
|
26
30
|
"""
|
27
|
-
def __init__(self, url=None, headless=False, proxy=None, user_agent=None, download_dir=None, chrome_path=None, chromedriver_path=None, maximize_window=True):
|
31
|
+
def __init__(self, url=None, headless=False, proxy=None, user_agent=None, download_dir=None, chrome_path=None, chromedriver_path=None, maximize_window=True, is_selenium_wire=False):
|
28
32
|
"""
|
29
33
|
初始化GetDriver
|
30
34
|
:param url: 允许的安全站点(用于insecure origin as secure)
|
@@ -52,6 +56,7 @@ class GetDriver:
|
|
52
56
|
import random
|
53
57
|
self.user_agent = user_agents[random.randint(0, len(user_agents) - 1)]
|
54
58
|
self.maximize_window = maximize_window
|
59
|
+
self.is_selenium_wire = is_selenium_wire
|
55
60
|
|
56
61
|
def check_proxy(self):
|
57
62
|
"""
|
@@ -173,7 +178,10 @@ class GetDriver:
|
|
173
178
|
try:
|
174
179
|
option.binary_location = chrome_path
|
175
180
|
service = Service(chromedriver_path)
|
176
|
-
|
181
|
+
if self.is_selenium_wire and wire_webdriver:
|
182
|
+
driver = wire_webdriver.Chrome(service=service, options=option)
|
183
|
+
else:
|
184
|
+
driver = selenium_webdriver.Chrome(service=service, options=option)
|
177
185
|
if self.maximize_window:
|
178
186
|
driver.maximize_window()
|
179
187
|
|
@@ -222,7 +230,10 @@ class GetDriver:
|
|
222
230
|
if not self.check_proxy():
|
223
231
|
raise GetDriverException(f"代理不可用或格式错误: {self.proxy}")
|
224
232
|
|
225
|
-
|
233
|
+
if self.is_selenium_wire and wire_webdriver:
|
234
|
+
option = wire_webdriver.ChromeOptions() # 浏览器启动选项
|
235
|
+
else:
|
236
|
+
option = selenium_webdriver.ChromeOptions() # 浏览器启动选项
|
226
237
|
if self.headless:
|
227
238
|
option.add_argument("--headless") # 设置无界面模式
|
228
239
|
option.add_argument("--window-size=1920,1080")
|
mdbq-4.0.75/mdbq/__version__.py
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
VERSION = '4.0.75'
|
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
|