So I am getting the following error
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
When I am trying to access the dataverse.
I searched online and found that the following worked for 99% of the people either
Just browse to Applications/Python 3.10 and double-click Install Certificates.command
or
pip3 install --upgrade certifi
I have tried both of them but I am still getting this error.
I have macOS Monterey version 12.6
This the full error I am getting
Traceback (most recent call last):
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self._make_request(
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self._validate_conn(conn)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/connectionpool.py", line 1042, in _validate_conn
conn.connect()
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/connection.py", line 414, in connect
self.sock = ssl_wrap_socket(
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 449, in ssl_wrap_socket
ssl_sock = _ssl_wrap_socket_impl(
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/util/ssl_.py", line 493, in _ssl_wrap_socket_impl
return ssl_context.wrap_socket(sock, server_hostname=server_hostname)
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 513, in wrap_socket
return self.sslsocket_class._create(
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1071, in _create
self.do_handshake()
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/ssl.py", line 1342, in do_handshake
self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='od.commons.osu.edu', port=443): Max retries exceeded with url: /api/v1/dataverses/foodshed/contents?User-Agent=pydataverse (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/pyDataverse/api.py", line 121, in get_request
resp = get(url, params=params)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/requests/api.py", line 73, in get
return request("get", url, params=params, **kwargs)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/requests/adapters.py", line 563, in send
raise SSLError(e, request=request)
requests.exceptions.SSLError: HTTPSConnectionPool(host='od.commons.osu.edu', port=443): Max retries exceeded with url: /api/v1/dataverses/foodshed/contents?User-Agent=pydataverse (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)')))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/Dataset.py", line 8, in <module>
resp_contents = api.get_dataverse_contents('foodshed')
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/pyDataverse/api.py", line 887, in get_dataverse_contents
return self.get_request(url, auth=auth)
File "/Users/***/Desktop/old laptop/RA/RCN/DataPipeline/lib/python3.10/site-packages/pyDataverse/api.py", line 139, in get_request
raise ConnectionError(
requests.exceptions.ConnectionError: ERROR: GET - Could not establish connection to api https://od.commons.osu.edu/api/v1/dataverses/foodshed/contents.
Process finished with exit code 1
I'll be grateful if anyone can let me know the fix for this error.