(Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate

requests库提示警告:

 (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1076)')))


 

但移除认证后控制台总是抛出警告:

 InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings

  InsecureRequestWarning)

根据提示路径https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings可找到方法一些解决办法,简单的办法可用移除警告:disable_warnings()

code

requests.packages.urllib3.disable_warnings()
r = requests.post(service_url, data=payload, headers=self.headers,verify = False)

 

 

 

 

 

 

上一篇:macOS cannot verify that this app is free from malware. 怎么解决显示全部 ​


下一篇:Flask-HTTPAuth基础案例