From 239cd1f23c4f5e9357a7184b68639b5bbcf4cf11 Mon Sep 17 00:00:00 2001 From: JoeamAmier Date: Sat, 26 Aug 2023 09:51:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/Html.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/source/Html.py b/source/Html.py index 808a3eb..89d073a 100644 --- a/source/Html.py +++ b/source/Html.py @@ -1,4 +1,3 @@ -import requests from requests import get @@ -21,16 +20,14 @@ class Html: self, url: str, params=None, - headers=None, - allow_redirects=True) -> str: + headers=None, ) -> str: try: response = get( url, params=params, proxies=self.proxies, timeout=self.timeout, - headers=headers or self.headers, - allow_redirects=allow_redirects, ) + headers=headers or self.headers, ) except ( requests.exceptions.ProxyError, requests.exceptions.SSLError, @@ -38,5 +35,6 @@ class Html: requests.exceptions.ConnectionError, requests.ReadTimeout, ): + print("获取网页源码失败!") return "" return response.text