Python gspread无法打开电子表格证书验证失败

时间:2016-06-21 19:09:51

标签: python oauth2 gspread

Python 3.4.3 for Windows

我正在尝试打开Goog​​le电子表格。所有行似乎都会加载,直到最后一行抛出证书验证失败。 文件SpreadSheet-99999.json有该位置,我不明白为什么它会抛出错误。 最后一行代码抛出错误。

代码:

import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['http://spreadsheets.google.com/feeds']
credentials = ServiceAccountCredentials.from_json_keyfile_name('SpreadSheet-99999.json', scope)
gc = gspread.authorize(credentials)

wks = gc.open("Call Metrics").sheet1

错误:

Traceback (most recent call last):
  File "Python\Python34\site-packages\requests\packages\urllib3\connectionpool.py", line 578, in urlopen
    chunked=chunked)
  File "Python\Python34\site-packages\requests\packages\urllib3\connectionpool.py", line 351, in _make_request
    self._validate_conn(conn)
  File "Python\Python34\site-packages\requests\packages\urllib3\connectionpool.py", line 814, in _validate_conn
    conn.connect()
  File "Python\Python34\site-packages\requests\packages\urllib3\connection.py", line 289, in connect
    ssl_version=resolved_ssl_version)
  File "Python\Python34\site-packages\requests\packages\urllib3\util\ssl_.py", line 308, in ssl_wrap_socket
    return context.wrap_socket(sock, server_hostname=server_hostname)
  File "C:\Python34\lib\ssl.py", line 365, in wrap_socket
    _context=self)
  File "C:\Python34\lib\ssl.py", line 583, in __init__
    self.do_handshake()
  File "C:\Python34\lib\ssl.py", line 810, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "Python\Python34\site-packages\requests\adapters.py", line 403, in send
    timeout=timeout
  File "C:\Users\gkearney\AppData\Roaming\Python\Python34\site-packages\requests\packages\urllib3\connectionpool.py", line 604, in urlopen
    raise SSLError(e)
requests.packages.urllib3.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "TestGoogleDocAccessGdata.py", line 12, in <module>
    wks = gc.open("Call Metrics").sheet1
  File "C:\Python34\lib\site-packages\gspread\client.py", line 145, in open
    feed = self.get_spreadsheets_feed()
  File "C:\Python34\lib\site-packages\gspread\client.py", line 231, in get_spreadsheets_feed
    r = self.session.get(url)
  File "C:\Python34\lib\site-packages\gspread\httpsession.py", line 75, in get
    return self.request('GET', url, **kwargs)
  File "C:\Python34\lib\site-packages\gspread\httpsession.py", line 67, in request
    response = func(url, data=data, headers=request_headers)
  File "C:\Users\gkearney\AppData\Roaming\Python\Python34\site-packages\requests\api.py", line 71, in get
    return request('get', url, params=params, **kwargs)
  File "C:\Users\gkearney\AppData\Roaming\Python\Python34\site-packages\requests\api.py", line 57, in request
    return session.request(method=method, url=url, **kwargs)
  File "C:\Users\gkearney\AppData\Roaming\Python\Python34\site-packages\requests\sessions.py", line 475, in request
    resp = self.send(prep, **send_kwargs)
  File "C:\Users\gkearney\AppData\Roaming\Python\Python34\site-packages\requests\sessions.py", line 585, in send
    r = adapter.send(request, **kwargs)
  File "C:\Users\gkearney\AppData\Roaming\Python\Python34\site-packages\requests\adapters.py", line 477, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

我拥有电子表格。 谢谢你的帮助。

0 个答案:

没有答案