3.2.24修复同域iframe问题;改进等待数据包功能

This commit is contained in:
g1879 2023-04-03 23:45:51 +08:00
parent 68b9fa15b1
commit 322ee10bd0
4 changed files with 3 additions and 6 deletions

View File

@ -1197,14 +1197,12 @@ class NetworkListener(object):
def _response_received(self, **kwargs):
"""接收到返回信息时处理方法"""
if kwargs['requestId'] in self._requests:
print(f"{kwargs['requestId']} _response_received")
self._requests[kwargs['requestId']]['response'] = kwargs['response']
def _loading_finished(self, **kwargs):
"""请求完成时处理方法"""
request_id = kwargs['requestId']
if request_id in self._requests:
print(f'{request_id} _loading_finished')
try:
body = self._page.run_cdp('Network.getResponseBody', requestId=request_id)['body']
except:
@ -1223,7 +1221,6 @@ class NetworkListener(object):
for target in self._targets:
if (self._is_regex and search(target, kwargs['request']['url'])) or (
not self._is_regex and target in kwargs['request']['url']):
print(f"{kwargs['requestId']} _requestWillBeSent")
self._requests[kwargs['requestId']] = {'target': target,
'post_data': kwargs['request'].get('postData', None),
'request_headers': kwargs['request']['headers']}

View File

@ -150,7 +150,7 @@ class ChromiumDriver(object):
self.event_handlers[event['method']](**event['params'])
except Exception as e:
raise
raise RuntimeError(f"\n回调函数错误:\n{e}")
# raise RuntimeError(f"\n回调函数错误\n{e}")
self.event_queue.task_done()

View File

@ -2,7 +2,7 @@ requests
lxml
cssselect
DownloadKit>=0.5.3
FlowViewer>=0.2.1
FlowViewer>=0.2.10
websocket-client
click
tldextract

View File

@ -23,7 +23,7 @@ setup(
'requests',
'cssselect',
'DownloadKit>=0.5.3',
'FlowViewer>=0.2.7',
'FlowViewer>=0.2.10',
'websocket-client',
'click~=8.1.3',
'tldextract'