python中的证书验证失败错误

2024-04-26 02:59:31 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试访问我们公司网络内部的https站点。 它给了我以下错误。在

    res = self.opener.open('https://%s/' % self.host, urllib.urlencode(data))
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1240, in https_open
    context=self._context)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1197, in do_open
    raise URLError(err)
urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

我正在MacOSX上工作,我已经更新了我的openssl版本。在

python -c "import ssl; print ssl.OPENSSL_VERSION"的输出是OpenSSL 1.0.2f 28 Jan 2016

我该怎么解决这个问题?在


Tags: inpyhttpsselflibusrlocalline