证书验证python中的失败错误

时间:2016-02-12 05:50:51

标签: python ssl

我正在尝试访问公司网络内部的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)>

我正在使用mac os x,我已经更新了我的openssl版本。

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

我该如何解决这个问题?

0 个答案:

没有答案