mdbq 4.0.73__py3-none-any.whl → 4.0.75__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.
mdbq/__version__.py CHANGED
@@ -1 +1 @@
1
- VERSION = '4.0.73'
1
+ VERSION = '4.0.75'
@@ -10,7 +10,6 @@ import tempfile
10
10
  import shutil
11
11
  import uuid
12
12
  import subprocess
13
- import json
14
13
 
15
14
  dir_path = os.path.expanduser("~")
16
15
 
@@ -81,19 +80,7 @@ class GetDriver:
81
80
  """
82
81
  try:
83
82
  if platform.system().lower() == 'windows':
84
- # Windows下尝试多种方式获取版本
85
- # 方法1: 尝试--version参数
86
- try:
87
- result = subprocess.run([chrome_path, '--version'],
88
- capture_output=True, text=True, timeout=10, shell=True)
89
- if result.returncode == 0:
90
- version_match = re.search(r'Chrome\s+(\d+\.\d+\.\d+\.\d+)', result.stdout)
91
- if version_match:
92
- return version_match.group(1)
93
- except:
94
- pass
95
-
96
- # 方法2: 尝试从注册表获取版本
83
+ # 方法1: 尝试从注册表获取版本
97
84
  try:
98
85
  import winreg
99
86
  key_path = r"SOFTWARE\Google\Chrome\BLBeacon"
@@ -102,8 +89,7 @@ class GetDriver:
102
89
  return version
103
90
  except:
104
91
  pass
105
-
106
- # 方法3: 尝试从文件属性获取版本
92
+ # 方法2: 尝试从文件属性获取版本
107
93
  try:
108
94
  result = subprocess.run(['wmic', 'datafile', 'where', f'name="{chrome_path.replace("/", "\\")}"', 'get', 'version', '/value'],
109
95
  capture_output=True, text=True, timeout=10, shell=True)
@@ -113,18 +99,6 @@ class GetDriver:
113
99
  return version_match.group(1)
114
100
  except:
115
101
  pass
116
-
117
- # 方法4: 尝试直接启动Chrome获取版本信息
118
- try:
119
- result = subprocess.run([chrome_path, '--headless', '--disable-gpu', '--dump-dom', 'about:version'],
120
- capture_output=True, text=True, timeout=15, shell=True)
121
- if result.returncode == 0:
122
- version_match = re.search(r'Chrome/(\d+\.\d+\.\d+\.\d+)', result.stdout)
123
- if version_match:
124
- return version_match.group(1)
125
- except:
126
- pass
127
-
128
102
  else:
129
103
  # macOS和Linux下使用--version参数
130
104
  result = subprocess.run([chrome_path, '--version'],
@@ -135,7 +109,8 @@ class GetDriver:
135
109
  if version_match:
136
110
  return version_match.group(1)
137
111
  except Exception as e:
138
- print(f"获取Chrome版本失败: {e}")
112
+ pass
113
+ # print(f"获取Chrome版本失败: {e}")
139
114
  return None
140
115
 
141
116
  def _get_chromedriver_version(self, chromedriver_path):
@@ -159,7 +134,8 @@ class GetDriver:
159
134
  if version_match:
160
135
  return version_match.group(1)
161
136
  except Exception as e:
162
- print(f"获取Chromedriver版本失败: {e}")
137
+ pass
138
+ # print(f"获取Chromedriver版本失败: {e}")
163
139
  return None
164
140
 
165
141
  def _check_version_compatibility(self, chrome_path, chromedriver_path):
@@ -171,10 +147,11 @@ class GetDriver:
171
147
  """
172
148
  chrome_version = self._get_chrome_version(chrome_path)
173
149
  chromedriver_version = self._get_chromedriver_version(chromedriver_path)
150
+ # print(f"Chrome版本: {chrome_version}, Chromedriver版本: {chromedriver_version}")
174
151
 
175
152
  # 如果无法获取版本信息,返回True允许尝试启动
176
153
  if not chrome_version or not chromedriver_version:
177
- print(f"警告: 无法获取版本信息 - Chrome: {chrome_version}, Chromedriver: {chromedriver_version}")
154
+ #(f"警告: 无法获取版本信息 - Chrome: {chrome_version}, Chromedriver: {chromedriver_version}")
178
155
  return True, chrome_version, chromedriver_version
179
156
 
180
157
  # 提取主版本号进行比较
@@ -231,7 +208,8 @@ class GetDriver:
231
208
 
232
209
  return driver
233
210
  except Exception as e:
234
- print(f"创建Chrome WebDriver失败: {e}")
211
+ pass
212
+ # print(f"创建Chrome WebDriver失败: {e}")
235
213
  return None
236
214
 
237
215
  def getdriver(self):
@@ -375,11 +353,11 @@ class GetDriver:
375
353
  self.driver = driver
376
354
  return driver
377
355
  else:
378
- print(f"版本不兼容: Chrome {chrome_version}, Chromedriver {chromedriver_version}")
356
+ # print(f"版本不兼容: Chrome {chrome_version}, Chromedriver {chromedriver_version}")
379
357
  # 即使版本不兼容也尝试启动,有时可能仍然可以工作
380
358
  driver = self._try_create_driver(chrome_path, chromedriver_path, option, temp_dir)
381
359
  if driver:
382
- print("警告:版本不兼容但启动成功,建议更新Chromedriver")
360
+ # print("警告: 版本不兼容, 建议更新Chromedriver")
383
361
  self.temp_dirs.append(temp_dir)
384
362
  self.driver = driver
385
363
  return driver
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: mdbq
3
- Version: 4.0.73
3
+ Version: 4.0.75
4
4
  Home-page: https://pypi.org/project/mdbq
5
5
  Author: xigua,
6
6
  Author-email: 2587125111@qq.com
@@ -1,5 +1,5 @@
1
1
  mdbq/__init__.py,sha256=Il5Q9ATdX8yXqVxtP_nYqUhExzxPC_qk_WXQ_4h0exg,16
2
- mdbq/__version__.py,sha256=v9CxLcSDpoYTepVqra_1iaKkOd7scJSGR8ITdcM5Nr4,18
2
+ mdbq/__version__.py,sha256=K7y6PvPpqJlMBeV-GYtOcSGoiW4MvAwSjrj5RDnI2TY,18
3
3
  mdbq/log/__init__.py,sha256=Mpbrav0s0ifLL7lVDAuePEi1hJKiSHhxcv1byBKDl5E,15
4
4
  mdbq/log/mylogger.py,sha256=kPe3wsQNaB1slfX-Z7VMqzZoMoqPfc7ylYXZDBeFzzI,24945
5
5
  mdbq/myconf/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
@@ -22,9 +22,9 @@ mdbq/pbix/refresh_all.py,sha256=OBT9EewSZ0aRS9vL_FflVn74d4l2G00wzHiikCC4TC0,5926
22
22
  mdbq/redis/__init__.py,sha256=YtgBlVSMDphtpwYX248wGge1x-Ex_mMufz4-8W0XRmA,12
23
23
  mdbq/redis/getredis.py,sha256=vpBuNc22uj9Vr-_Dh25_wpwWM1e-072EAAIBdB_IpL0,23494
24
24
  mdbq/selenium/__init__.py,sha256=AKzeEceqZyvqn2dEDoJSzDQnbuENkJSHAlbHAD0u0ZI,10
25
- mdbq/selenium/get_driver.py,sha256=ppV_CJvvRu2__VIYQS-nfhW0lOlesuR11bG_d2MfmNs,21523
25
+ mdbq/selenium/get_driver.py,sha256=ma0XgXJtpPW-ftzukShXnjkZBkekKqjtKQfkZ_UGM5k,20375
26
26
  mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
27
- mdbq-4.0.73.dist-info/METADATA,sha256=i2uf1d6ZPcI60XOSOGXW6wgePbz_pHsumb0-LGJD8Ns,364
28
- mdbq-4.0.73.dist-info/WHEEL,sha256=jB7zZ3N9hIM9adW7qlTAyycLYW9npaWKLRzaoVcLKcM,91
29
- mdbq-4.0.73.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
30
- mdbq-4.0.73.dist-info/RECORD,,
27
+ mdbq-4.0.75.dist-info/METADATA,sha256=fmoz5BV-r0BnyiThBzKL7SOA1pWf5l_ylZXIOMTFkUg,364
28
+ mdbq-4.0.75.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
29
+ mdbq-4.0.75.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
30
+ mdbq-4.0.75.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.8.2)
2
+ Generator: setuptools (80.9.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5