我是aware of the update in Python 3.6,您需要在其中运行“ Install Certificates.command”以使SSL再次起作用,但是它似乎不适用于我。
运行文件会导致:
-- pip install --upgrade certifi
Requirement already up-to-date: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2018.4.16)
-- removing any existing file or link
-- creating symlink to certifi certificate bundle
-- setting permissions
-- update complete
我也明确地运行了
pip3 install certifi
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2018.4.16)
但是,当我尝试运行应用程序(using suds-py3)时,我得到以下信息:
Traceback (most recent call last):
File "./get_docs.py", line 38, in <module>
session = Client(url_SessionWebService)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/client.py", line 111, in __init__
self.wsdl = reader.open(url)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/reader.py", line 151, in open
d = self.fn(url, self.options)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/wsdl.py", line 135, in __init__
d = reader.open(url)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/reader.py", line 78, in open
d = self.download(url)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/reader.py", line 94, in download
fp = self.options.transport.open(Request(url))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py", line 174, in open
return HttpTransport.open(self, request)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py", line 63, in open
return self.u2open(u2request)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/suds/transport/http.py", line 119, in u2open
return url.open(u2request, timeout=tm)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 532, in open
response = meth(req, response)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 642, in http_response
'http', request, response, code, msg, hdrs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 564, in error
result = self._call_chain(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 756, in http_error_302
return self.parent.open(new, timeout=req.timeout)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 526, in open
response = self._open(req, data)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 544, in _open
'_open', req)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 504, in _call_chain
result = func(*args)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1361, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1320, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)>
我还尝试添加以下内容以绕过:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
但是结果呼叫似乎表明请求未通过验证
关于如何进一步调试的任何建议?
答案 0 :(得分:0)
我刚刚解决了我的问题: 要安装证书,请执行以下操作:
python3 -m pip install --upgrade certifi --trusted-host pypi.org --trusted-host files.pythonhosted.org
您只需将该命令复制并粘贴到Mac终端或任何IDE终端(例如Visual Studio代码)中即可。