mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
4.0.0b34修复get()timeout很短时报错问题
This commit is contained in:
parent
ecfa83dcf8
commit
5c8ba2da58
@ -13,4 +13,4 @@ from ._configs.chromium_options import ChromiumOptions
|
|||||||
from ._configs.session_options import SessionOptions
|
from ._configs.session_options import SessionOptions
|
||||||
|
|
||||||
__all__ = ['ChromiumPage', 'ChromiumOptions', 'SessionOptions', 'SessionPage', 'WebPage', '__version__']
|
__all__ = ['ChromiumPage', 'ChromiumOptions', 'SessionOptions', 'SessionPage', 'WebPage', '__version__']
|
||||||
__version__ = '4.0.0b33'
|
__version__ = '4.0.0b34'
|
||||||
|
@ -13,7 +13,7 @@ from psutil import process_iter, AccessDenied, NoSuchProcess, ZombieProcess
|
|||||||
|
|
||||||
from .._configs.options_manage import OptionsManager
|
from .._configs.options_manage import OptionsManager
|
||||||
from ..errors import (ContextLostError, ElementLostError, CDPError, PageDisconnectedError, NoRectError,
|
from ..errors import (ContextLostError, ElementLostError, CDPError, PageDisconnectedError, NoRectError,
|
||||||
AlertExistsError, WrongURLError, StorageError, CookieFormatError)
|
AlertExistsError, WrongURLError, StorageError, CookieFormatError, JavaScriptError)
|
||||||
|
|
||||||
|
|
||||||
def get_usable_path(path, is_file=True, parents=True):
|
def get_usable_path(path, is_file=True, parents=True):
|
||||||
@ -279,12 +279,15 @@ def raise_error(result, ignore=None):
|
|||||||
r = StorageError()
|
r = StorageError()
|
||||||
elif error == 'Sanitizing cookie failed':
|
elif error == 'Sanitizing cookie failed':
|
||||||
r = CookieFormatError(f'cookie格式不正确:{result["args"]}')
|
r = CookieFormatError(f'cookie格式不正确:{result["args"]}')
|
||||||
|
elif error == 'Given expression does not evaluate to a function':
|
||||||
|
r = JavaScriptError(f'传入的js无法解析成函数:\n{result["args"]["functionDeclaration"]}')
|
||||||
elif result['type'] in ('call_method_error', 'timeout'):
|
elif result['type'] in ('call_method_error', 'timeout'):
|
||||||
from DrissionPage import __version__
|
from DrissionPage import __version__
|
||||||
from time import process_time
|
from time import process_time
|
||||||
r = CDPError(f'\n错误:{result["error"]}\nmethod:{result["method"]}\nargs:{result["args"]}\n'
|
txt = f'\n错误:{result["error"]}\nmethod:{result["method"]}\nargs:{result["args"]}\n' \
|
||||||
f'版本:{__version__}\n运行时间:{process_time()}\n出现这个错误可能意味着程序有bug,请把错误信息和重现方法'
|
f'版本:{__version__}\n运行时间:{process_time()}\n出现这个错误可能意味着程序有bug,请把错误信息和重现方法' \
|
||||||
'告知作者,谢谢。\n报告网站:https://gitee.com/g1879/DrissionPage/issues')
|
'告知作者,谢谢。\n报告网站:https://gitee.com/g1879/DrissionPage/issues'
|
||||||
|
r = TimeoutError(txt) if result['type'] == 'timeout' else CDPError(txt)
|
||||||
else:
|
else:
|
||||||
r = RuntimeError(result)
|
r = RuntimeError(result)
|
||||||
|
|
||||||
|
2
setup.py
2
setup.py
@ -6,7 +6,7 @@ with open("README.md", "r", encoding='utf-8') as fh:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name="DrissionPage",
|
name="DrissionPage",
|
||||||
version="4.0.0b33",
|
version="4.0.0b34",
|
||||||
author="g1879",
|
author="g1879",
|
||||||
author_email="g1879@qq.com",
|
author_email="g1879@qq.com",
|
||||||
description="Python based web automation tool. It can control the browser and send and receive data packets.",
|
description="Python based web automation tool. It can control the browser and send and receive data packets.",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user