开发者

Retrieving token and secret from gdata.gauth.OAuthHmacToken python object

开发者 https://www.devze.com 2023-02-23 01:23 出处:网络
I\'m following Google\'s great sample code for three-legged OAuth. Specifically, I\'m looking at the python version of the code. I\'m stuck between \'Upgrading to an access token\' and \'Using an acc

I'm following Google's great sample code for three-legged OAuth.

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)

I assume TOKEN and TOKEN_SECRET are packed into the access_token object (gdata.gauth.OAuthHmacToken), but how do I retrieve them?

Thanks!


I was able to figure this out.

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
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号