问题描述
我正在关注Google出色的
I'm following Google's great sample code for three-legged OAuth.
具体来说,我正在看代码的python版本。我被困在升级到访问令牌和使用访问令牌之间。
Specifically, I'm looking at the python version of the code. I'm stuck between 'Upgrading to an access token' and 'Using an access token'.
在升级到访问令牌中,有一行代码如下所示:
In 'Upgrading to an access token', there is a line of code as follows:
access_token = client.GetAccessToken(request_token)
在使用访问令牌中,有一行代码如下:
In 'Using an access token', there is a line of code as follows:
client.auth_token = gdata.gauth.OAuthHmacToken(CONSUMER_KEY,
CONSUMER_SECRET,
TOKEN,
TOKEN_SECRET,
gdata.gauth.ACCESS_TOKEN)
我假设 TOKEN
和 TOKEN_SECRET
被打包到 access_token
对象( gdata.gauth.OAuthHmacToken
)中,但是如何检索
I assume TOKEN
and TOKEN_SECRET
are packed into the access_token
object (gdata.gauth.OAuthHmacToken
), but how do I retrieve them?
谢谢!
推荐答案
我是abl e可以解决这个问题。
I was able to figure this out.
access_token
类型为 gdata.gauth.OAuthHmacToken
。因此,除了尝试传递各个参数外,我还可以这样做:
access_token
is of type gdata.gauth.OAuthHmacToken
. So instead of trying to pass in the individual arguments, I could just do this:
client.auth_token = access_token
这篇关于从gdata.gauth.OAuthHmacToken python对象检索令牌和机密的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!