From 76d35fb2c6d3475db16977c552e8d06f0e04cfbb Mon Sep 17 00:00:00 2001 From: nilm Date: Mon, 13 Apr 2020 20:28:20 +0800 Subject: [PATCH] =?UTF-8?q?The=20request=20problems=20in=20debug=20mode=20?= =?UTF-8?q?are=20displayed,=20which=20is=20convenient=20for=20users=20to?= =?UTF-8?q?=20add=20parameters=E3=80=82=20=E7=BB=8Fdebug=E6=A8=A1=E5=BC=8F?= =?UTF-8?q?=E4=B8=8B=E5=87=BA=E7=8E=B0=E7=9A=84=E8=AF=B7=E6=B1=82=E9=97=AE?= =?UTF-8?q?=E9=A2=98=E6=98=BE=E7=A4=BA=E5=87=BA=E6=9D=A5=EF=BC=8C=E6=96=B9?= =?UTF-8?q?=E4=BE=BF=E7=94=A8=E6=88=B7=E5=A2=9E=E5=8A=A0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=20Case=20=E5=9C=BA=E6=99=AF=EF=BC=9A=201.=20?= =?UTF-8?q?Appear=20directly=20using=20the=20command=20line=20=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E4=BD=BF=E7=94=A8=E5=91=BD=E4=BB=A4=E8=A1=8C=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=EF=BC=9A=20you-get:=20[error]=20oops,=20something=20w?= =?UTF-8?q?ent=20wrong.=20=E2=80=A6=E2=80=A6=20you-get:=20=20=20(4)=20Run?= =?UTF-8?q?=20the=20command=20with=20'--debug'=20option,?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 2. Run the command with '--debug' option增加—debug 选项出现: TypeError: the JSON object must be str, bytes or bytearray, not NoneType But the error is not the problem here. It's the problem in the request. 但错误并不是此处问题,而是请求时出现了问题。 ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1076) In order to prevent other problems and not affect the execution of subsequent programs, other exception displays requested in debug mode are added here. 为防止其他问题出现,不影响后续程序的执行,在此增加了debug模式下请求的其他异常显示。 Note: the solution can also use the -k option 注:解决方案也可使用 -k 选项 --- src/you_get/common.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/you_get/common.py b/src/you_get/common.py index 2e4edef5..e2e6054c 100755 --- a/src/you_get/common.py +++ b/src/you_get/common.py @@ -416,6 +416,8 @@ def urlopen_with_retry(*args, **kwargs): logging.debug('HTTP Error with code{}'.format(http_error.code)) if i + 1 == retry_time: raise http_error + except Exception as else_error: + logging.debug(else_error) def get_content(url, headers={}, decoded=True):