1.requests.exceptions.SSLError: HTTPSConnectionPool(host='xxx.com', port=443)
解决方案:
r = requests.get('https://www.12306.cn', verify=False)
参考:https://blog.youkuaiyun.com/a19990412/article/details/80358084
2.InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised.
解决方案:
import urllib3 requests.packages.urllib3.disable_warnings()
参考:See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
https://www.jianshu.com/p/7bacf7d9ae5a
本文介绍了如何解决在使用Python的requests库进行HTTPS请求时遇到的SSLError和InsecureRequestWarning警告。通过设置verify参数为False可以避免SSL验证错误,但不建议在生产环境中使用。同时,禁用urllib3的警告可以消除未验证HTTPS请求的警告。
712

被折叠的 条评论
为什么被折叠?



