如何使用我的oauth凭据?我对http响应gspread.httpsession.HTTPError有错误:(有人能告诉我我的代码出了什么问题吗?
import datetime
import gspread
import json
import MySQLdb
from oauth2client.client import OAuth2Credentials
# Get access token from database
data = json.loads(row['access_token'])
credentials = OAuth2Credentials(
data['access_token'],
"1*************************k.apps.googleusercontent.com",
"9t*****************W",
data['refresh_token'],
datetime.datetime.now(),
"https://accounts.google.com/o/oauth2/token",
'user-agent'
)
gc = gspread.authorize(credentials)
wks = gc.open_by_key('1*****************W')其中row包含来自数据库的数据(它具有由google oauth返回的访问令牌)?m(_ _)
发布于 2014-10-21 00:54:55
我在使用Oauth2Credentials进行身份验证时也遇到了一些麻烦。我的建议是使用googles Oauth2工作流来创建凭据。此外,请确保使用'https://spreadsheets.google.com/feeds‘作为凭据的作用域。
我目前正在使用这个过程,并且我的呼叫工作正常。
https://stackoverflow.com/questions/26155547
复制相似问题