System Setup:
- macOS 10.14.1
- Python 3.7.0
- pip 18.1
I wrote code that worked in the past, but when I run it now, I'm getting the following error:
urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)>
I've ran into an issue like this before when I was trying to use requests to access an API and it wouldn't let me make connections over HTTPS. The error isn't code related, because it worked 6 months ago. What could be causing this? Something with my certificate?
The code my function is calling is:
url = self.DUST_SERVICE_URL
request_payload = self._args_to_payload(coordinate, radius=radius)
response = self._request("POST", url, data=request_payload,
timeout=timeout)
xml_tree = utils.xml(response.text)
result = SingleDustResult(xml_tree, coordinate)
return commons.FileContainer(result.ext_detail_table(),
show_progress=show_progress)
This code is from a package; I did not write this code.
Edit: Full error message below.
/Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py", line 1317, in do_open
encode_chunked=req.has_header('Transfer-encoding'))
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1016, in _send_output
self.send(msg)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 956, in send
self.connect()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 1392, in connect
server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 412, in wrap_socket
session=session
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 850, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1108, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1045)
If this is an SSL issue (that's what I suspect) how would I go about resetting to system default? I've never dabbled in SSL or connections besides requesting things via Python Requests so I don't know how I would've changed something.