当我尝试使用gspread访问谷歌电子表格时,它总是返回“提升ResponseNotReady()”,我只是按照Github中的用户指南,我不熟悉httplib和gspread,有人可以告诉我如何做对了,谢谢你的帮助
源代码:
import gspread
from oauth2client.service_account import ServiceAccountCredentials
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
creds = ServiceAccountCredentials.from_json_keyfile_name('Orait-2018-06-09-200299f40c5e.json', scope)
client = gspread.authorize(creds)
wks = gc.open("sheet1").sheet1
追溯信息:
Traceback (most recent call last):
File "D:\python\test2.py", line 8, in <module>
client = gspread.authorize(creds)
File "C:\Python27\lib\site-packages\gspread\__init__.py", line 38, in authorize
client.login()
File "C:\Python27\lib\site-packages\gspread\client.py", line 51, in login
self.auth.refresh(http)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 545, in refresh
self._refresh(http)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 749, in _refresh
self._do_refresh_request(http)
File "C:\Python27\lib\site-packages\oauth2client\client.py", line 780, in _do_refresh_request
body=body, headers=headers)
File "C:\Python27\lib\site-packages\oauth2client\transport.py", line 282, in request
connection_type=connection_type)
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1694, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1434, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "C:\Python27\lib\site-packages\httplib2\__init__.py", line 1390, in _conn_request
response = conn.getresponse()
File "C:\Python27\lib\httplib.py", line 1108, in getresponse
raise ResponseNotReady()
httplib.ResponseNotReady
[Finished in 22.3s with exit code 1]
[shell_cmd: python -u "D:\python\test2.py"]