mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
微调get()逻辑;不指定用户文件夹路径时优先选择tmp_path
This commit is contained in:
parent
5c8ba2da58
commit
1be8f00c21
@ -87,7 +87,8 @@ def get_launch_args(opt):
|
||||
|
||||
if not has_user_path and not opt.system_user_path:
|
||||
port = opt.address.split(':')[-1] if opt.address else '0'
|
||||
path = Path(gettempdir()) / 'DrissionPage' / f'userData_{port}'
|
||||
p = Path(opt.tmp_path) if opt.tmp_path else Path(gettempdir()) / 'DrissionPage'
|
||||
path = p / f'userData_{port}'
|
||||
path.mkdir(parents=True, exist_ok=True)
|
||||
opt.set_user_data_path(path)
|
||||
result.add(f'--user-data-dir={path}')
|
||||
|
@ -6,7 +6,7 @@
|
||||
from json import loads, JSONDecodeError
|
||||
from os.path import sep
|
||||
from pathlib import Path
|
||||
from re import findall, match
|
||||
from re import findall
|
||||
from threading import Thread
|
||||
from time import perf_counter, sleep
|
||||
from urllib.parse import quote
|
||||
@ -894,13 +894,7 @@ class ChromiumBase(BasePage):
|
||||
:param interval: 重试间隔
|
||||
:return: 重试次数和间隔组成的tuple
|
||||
"""
|
||||
url = quote(url, safe='-_.~!*\'"();:@&=+$,/\\?#[]%')
|
||||
if not url:
|
||||
self._url = 'chrome://newtab/'
|
||||
elif not match(r'.*?://', url):
|
||||
self._url = f'http://{url}'
|
||||
else:
|
||||
self._url = url
|
||||
self._url = quote(url, safe='-_.~!*\'"();:@&=+$,/\\?#[]%') or 'chrome://newtab/'
|
||||
retry = retry if retry is not None else self.retry_times
|
||||
interval = interval if interval is not None else self.retry_interval
|
||||
return retry, interval
|
||||
|
Loading…
x
Reference in New Issue
Block a user