0
点赞
收藏
分享

微信扫一扫

python3 urllib.requesturlopen 一个https 时ssl证书错误!


python3 urllib.requesturlopen 一个https 时ssl证书错误!

不知道从那个版本起,python用urlopen打开一个https时会验证一次 SSL 证书,当目标使用的是自签名的证书时就会爆出一个 

<urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:749)>

解决办法是:通过导入ssl模块,把证书验证关了

import  ssl
ssl._create_default_https_context = ssl._create_unverified_context

举报

相关推荐

0 条评论