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 = '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
わかりました(これでいいです)
http://static.indjango.com/python-gspread/screen-8.png (まだ写真の投稿は許可されていません)
問題:
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)
これを修正するにはどうすればよいですか?
この特定のチュートリアル。