试图访问google电子表格python,可以';我拿不到证件
我正试图通过python将数据发送到google电子表格。很多教程之后,我遇到了以下错误 当我运行此Python代码时:试图访问google电子表格python,可以';我拿不到证件,python,google-sheets,raspberry-pi3,Python,Google Sheets,Raspberry Pi3,我正试图通过python将数据发送到google电子表格。很多教程之后,我遇到了以下错误 当我运行此Python代码时: from oauth2client.client import OAuth2WebServerFlow from oauth2client.tools import run_flow from oauth2client.file import Storage from oauth2client.tools import argparser CLIENT_ID = 'xxxx
from oauth2client.client import OAuth2WebServerFlow
from oauth2client.tools import run_flow
from oauth2client.file import Storage
from oauth2client.tools import argparser
CLIENT_ID = 'xxxxxxxgleusercontent.com'
CLIENT_SECRET = 'xxxxxxxxx'
flow = OAuth2WebServerFlow(
client_id = CLIENT_ID,
client_secret = CLIENT_SECRET,
scope = 'https://spreadsheets.google.com/feeds https://docs.google.com/feeds',
redirect_uri = 'http://example.com/auth_return'
)
flags = argparser.parse_args(args=[])
storage = Storage('creds.data')
credentials = run_flow(flow, storage, flags)
print "access_token: %s" % credentials.access_token
我明白了(这很好)
(尚不允许发布图片)
问题:
Traceback (most recent call last):
File "/home/pi/Desktop/gs/gs.py", line 43, in <module>
credentials = run_flow(flow, storage, flags)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 135, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/tools.py", line 235, in run_flow
credential = flow.step2_exchange(code, http=http)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 135, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/oauth2client/client.py", line 2102, in step2_exchange
headers=headers)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1609, in request
(response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1351, in _request
(response, content) = self._conn_request(conn, request_uri, method, body, headers)
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1272, in _conn_request
conn.connect()
File "/usr/local/lib/python2.7/dist-packages/httplib2/__init__.py", line 1059, in connect
raise SSLHandshakeError(e)
SSLHandshakeError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)
回溯(最近一次呼叫最后一次):
文件“/home/pi/Desktop/gs/gs.py”,第43行,在
凭证=运行流(流、存储、标志)
文件“/usr/local/lib/python2.7/dist packages/oauth2client/util.py”,第135行,在位置包装中
已包装退货(*args,**kwargs)
文件“/usr/local/lib/python2.7/dist packages/oauth2client/tools.py”,第235行,在运行流程中
凭证=flow.step2_交换(代码,http=http)
文件“/usr/local/lib/python2.7/dist packages/oauth2client/util.py”,第135行,在位置包装中
已包装退货(*args,**kwargs)
文件“/usr/local/lib/python2.7/dist packages/oauth2client/client.py”,第2102行,在步骤2中
页眉=页眉)
请求中的文件“/usr/local/lib/python2.7/dist packages/httplib2/_init__;.py”,第1609行
(响应,内容)=self.\u请求(conn,authority,uri,request\u uri,method,body,header,重定向,cachekey)
文件“/usr/local/lib/python2.7/dist-packages/httplib2/_-init___;.py”,请求中的第1351行
(响应,内容)=自连接请求(连接,请求uri,方法,正文,标题)
文件“/usr/local/lib/python2.7/dist-packages/httplib2/_-init___uuu.py”,第1272行,在连接请求中
连接
文件“/usr/local/lib/python2.7/dist-packages/httplib2/_init__;.py”,第1059行,在connect中
升起SSLhandshake错误(e)
SSLHandshakeError:[SSL:证书\u验证\u失败]证书验证失败(\u SSL.c:581)
我能做些什么来解决这个问题
特定教程。那么,当您单击“接受”或单击“接受”时会发生此回溯?您可能应该将重定向url更改为
http://localhost:8080/
。