gspread: `ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)` When opening sheet
After successfully authenticating I’m getting an SSL error whenever I try to open a sheet.
scope = ['https://spreadsheets.google.com/feeds']
credentials = SignedJwtAssertionCredentials(GOOGLE_AUTH['client_email'], GOOGLE_AUTH['private_key'], scope)
gc = gspread.authorize(credentials)
sh = gc.open('Genesis-QuestionBank')
Traceback (most recent call last):
File "genesis/bin/import_questions.py", line 27, in <module>
sh = gc.open('Genesis-QuestionBank')
File "/Users/administrator2/.virtualenvs/genesis/lib/python2.7/site-packages/gspread/client.py", line 134, in open
feed = self.get_spreadsheets_feed()
File "/Users/administrator2/.virtualenvs/genesis/lib/python2.7/site-packages/gspread/client.py", line 220, in get_spreadsheets_feed
r = self.session.get(url)
File "/Users/administrator2/.virtualenvs/genesis/lib/python2.7/site-packages/gspread/httpsession.py", line 79, in get
return self.request('GET', url, **kwargs)
File "/Users/administrator2/.virtualenvs/genesis/lib/python2.7/site-packages/gspread/httpsession.py", line 71, in request
uri.scheme + uri.netloc].request(method, url, data, headers=request_headers)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1001, in request
self._send_request(method, url, body, headers)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1035, in _send_request
self.endheaders(body)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 997, in endheaders
self._send_output(message_body)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 850, in _send_output
self.send(msg)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 812, in send
self.connect()
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1212, in connect
server_hostname=server_hostname)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 350, in wrap_socket
_context=self)
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 566, in __init__
self.do_handshake()
File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/ssl.py", line 788, in do_handshake
self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 18 (2 by maintainers)
So, I don’t know what happened, but for some reasons python package Requests 2.16.0 started requiring Certifi, which causes this SSL error. I had to specify version 2.15.1 to be able to uninstall certifi and restore service to my automation.
pip install requests==2.15.1; pip uninstall -y certifiI thought I posted a comment about what this was for me - it turned out the Python package “certifi” which is part of a other Python package “Tornado” was causing this error. I used:
pip uninstall -y certifi
And the error went away, and Tornado appeared to still work.
This issue is back, and now requests looks like it depends on certifi to function. I’ll post here again if I figure it out.