From 57b46e7b268d2bfb00e680f08f1ba07ba136201d Mon Sep 17 00:00:00 2001 From: g1879 Date: Wed, 5 Apr 2023 22:42:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=E5=88=9B=E5=BB=BAResponseDat?= =?UTF-8?q?a=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DrissionPage/chromium_base.py | 12 ++++++++---- requirements.txt | 2 +- setup.py | 2 +- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/DrissionPage/chromium_base.py b/DrissionPage/chromium_base.py index 851584b..12aceb4 100644 --- a/DrissionPage/chromium_base.py +++ b/DrissionPage/chromium_base.py @@ -1204,16 +1204,20 @@ class NetworkListener(object): request_id = kwargs['requestId'] if request_id in self._requests: try: - body = self._page.run_cdp('Network.getResponseBody', requestId=request_id)['body'] - except: - body = None + r = self._page.run_cdp('Network.getResponseBody', requestId=request_id) + body = r['body'] + is_base64 = r['base64Encoded'] + except CallMethodError: + body = '' + is_base64 = False request = self._requests[request_id] target = request['target'] rd = ResponseData(request_id, request['response'], body, self._page.tab_id, target) rd.postData = request['post_data'] - rd._requestHeaders = request['request_headers'] + rd._base64_body = is_base64 + rd.requestHeaders = request['request_headers'] self._results[target] = rd def _requestWillBeSent(self, **kwargs): diff --git a/requirements.txt b/requirements.txt index bd8c135..d04ff8e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,7 +2,7 @@ requests lxml cssselect DownloadKit>=0.5.3 -FlowViewer>=0.2.10 +FlowViewer>=0.3.0 websocket-client click tldextract \ No newline at end of file diff --git a/setup.py b/setup.py index fcee54f..1b1ce9c 100644 --- a/setup.py +++ b/setup.py @@ -23,7 +23,7 @@ setup( 'requests', 'cssselect', 'DownloadKit>=0.5.3', - 'FlowViewer>=0.2.10', + 'FlowViewer>=0.3.0', 'websocket-client', 'click~=8.1.3', 'tldextract'