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

I follow Google with a great sample code for tripartite OAuth.

In particular, I am looking at the python code version. I am stuck between "Upgrading to an access token" and "Using an access token."

In the section “Upgrade 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 that TOKEN and TOKEN_SECRET packaged in an access_token object ( gdata.gauth.OAuthHmacToken ), but how do I get them?

Thanks!

+4
source share
1 answer

I was able to figure it out.

access_token is of type gdata.gauth.OAuthHmacToken . So instead of trying to pass individual arguments, I could just do this:

 client.auth_token = access_token 
+1
source

Source: https://habr.com/ru/post/1346942/


All Articles