mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
3.2.24修复同域iframe问题;改进等待数据包功能
This commit is contained in:
parent
68b9fa15b1
commit
322ee10bd0
@ -1197,14 +1197,12 @@ class NetworkListener(object):
|
|||||||
def _response_received(self, **kwargs):
|
def _response_received(self, **kwargs):
|
||||||
"""接收到返回信息时处理方法"""
|
"""接收到返回信息时处理方法"""
|
||||||
if kwargs['requestId'] in self._requests:
|
if kwargs['requestId'] in self._requests:
|
||||||
print(f"{kwargs['requestId']} _response_received")
|
|
||||||
self._requests[kwargs['requestId']]['response'] = kwargs['response']
|
self._requests[kwargs['requestId']]['response'] = kwargs['response']
|
||||||
|
|
||||||
def _loading_finished(self, **kwargs):
|
def _loading_finished(self, **kwargs):
|
||||||
"""请求完成时处理方法"""
|
"""请求完成时处理方法"""
|
||||||
request_id = kwargs['requestId']
|
request_id = kwargs['requestId']
|
||||||
if request_id in self._requests:
|
if request_id in self._requests:
|
||||||
print(f'{request_id} _loading_finished')
|
|
||||||
try:
|
try:
|
||||||
body = self._page.run_cdp('Network.getResponseBody', requestId=request_id)['body']
|
body = self._page.run_cdp('Network.getResponseBody', requestId=request_id)['body']
|
||||||
except:
|
except:
|
||||||
@ -1223,7 +1221,6 @@ class NetworkListener(object):
|
|||||||
for target in self._targets:
|
for target in self._targets:
|
||||||
if (self._is_regex and search(target, kwargs['request']['url'])) or (
|
if (self._is_regex and search(target, kwargs['request']['url'])) or (
|
||||||
not self._is_regex and target in kwargs['request']['url']):
|
not self._is_regex and target in kwargs['request']['url']):
|
||||||
print(f"{kwargs['requestId']} _requestWillBeSent")
|
|
||||||
self._requests[kwargs['requestId']] = {'target': target,
|
self._requests[kwargs['requestId']] = {'target': target,
|
||||||
'post_data': kwargs['request'].get('postData', None),
|
'post_data': kwargs['request'].get('postData', None),
|
||||||
'request_headers': kwargs['request']['headers']}
|
'request_headers': kwargs['request']['headers']}
|
||||||
|
@ -150,7 +150,7 @@ class ChromiumDriver(object):
|
|||||||
self.event_handlers[event['method']](**event['params'])
|
self.event_handlers[event['method']](**event['params'])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise
|
raise
|
||||||
raise RuntimeError(f"\n回调函数错误:\n{e}")
|
# raise RuntimeError(f"\n回调函数错误:\n{e}")
|
||||||
|
|
||||||
self.event_queue.task_done()
|
self.event_queue.task_done()
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ requests
|
|||||||
lxml
|
lxml
|
||||||
cssselect
|
cssselect
|
||||||
DownloadKit>=0.5.3
|
DownloadKit>=0.5.3
|
||||||
FlowViewer>=0.2.1
|
FlowViewer>=0.2.10
|
||||||
websocket-client
|
websocket-client
|
||||||
click
|
click
|
||||||
tldextract
|
tldextract
|
Loading…
x
Reference in New Issue
Block a user