问题
I am aware of the update in Python 3.6 where you need to run the 'Install Certificates.command' in order to get SSL working again, however it doesn't seem to work for me.
Running the file results in:
-- 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
And I've also explicitly run
pip3 install certifi
Requirement already satisfied: certifi in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (2018.4.16)
Yet when I try to run my application (using suds-py3) I get the following:
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)>
I've also tried adding the following to bypass:
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
But the resulting call seems to indicate that the request was not authenticated
Any suggestions on how to further debug this?
回答1:
I have just solved the problem in my side: to install certifi do this:
python3 -m pip install --upgrade certifi --trusted-host pypi.org --trusted-host files.pythonhosted.org
You just copy and paste that command in your Mac terminal or any IDE terminal such as Visual Studio code.
来源:https://stackoverflow.com/questions/50982953/certificate-verify-failed-python-3-6-mac-osx-cant-fix-with-install-certificate