1

I want to integrate user's vimeo videos in my web application and I got this code in github https://gist.github.com/2944212 Using that code I can fetch oauth_signature value.

Now I'm having this parameter.

params = {
    'oauth_consumer_key': 'XXXXXXXXXXXXXXXXXXXX',
    'oauth_callback': callback,
    'oauth_nonce': nonce,
    'oauth_signature_method': 'HMAC-SHA1',
    'oauth_signature': 'XXXXXXXXXXXXXXXXXXXX',
    'oauth_timestamp': timestamp,
    'oauth_version': '1.0'
}

With that How can I fetch oauth_token https://developer.vimeo.com/apis/advanced#oauth in Python?

Could anyone guide me?

Thanks!

rnk
  • 2,174
  • 4
  • 35
  • 57

1 Answers1

1

Using the code you posted. Just reading the result of r.text at the end should give you a oauth_token and oauth_token_secret (as well as an oauth_callback_confirmed parameter).

What you have received is in fact a request token, which needs to be authorized by a user:

Open a web browser pointing to https://vimeo.com/oauth/authorize?oauth_token=THE_OAUTH_TOKEN_YOU_JUST_RECEIVED. Log in there and you will be redirected to your callback. At the end of the callback URL you will see your oauth_token again, and an oauth_verifier parameter, something like this:

http://stage.bahai.us/apps/terrace/vimeo-callback?oauth_token=a9fb93ebef0fb42cbb96c92ff917b7ea&oauth_verifier=c7afdb2b65c1d77e0cf09687ddc5a8d5

Now you can proceed to get the access token, which is what you need to do full API requests to vimeo.

Add the oauth_token, and the oauth_verifier to a similar request as you did in the script you linked. When you sign your request you will need to sign it with both your consumer and your token:

req.sign_request(signature_method, consumer, token)

And send this request to the https://vimeo.com/oauth/access_token endpoint. This should give you a direct response, again by reading the response text, containing your access token and access token secret.

Jon Nylander
  • 8,743
  • 5
  • 34
  • 45
  • Thanks! Now I got **oauth_token, oauth_token_secret, oauth_verifier** I added all these things to the parameter and made request again as you said and now I'm getting this error https://gist.github.com/2953647 – rnk Jun 19 '12 at 11:36
  • The token parameter should not be a string but a key value pair with both the key and the secret. Such as oauth.Token(key=oauth_token, secret=oauth_token_secret) – Jon Nylander Jun 19 '12 at 13:41
  • Yes, I got it. How can I make this `requests.get` for getting access_token?. When I tried like this `r = requests.get(url, headers=headers)` I'm again getting the oauth_token and secret. – rnk Jun 19 '12 at 14:07
  • I need your help once again. Please check this https://gist.github.com/2954418 How can I get access_token? – rnk Jun 19 '12 at 14:32
  • You can also check this if you need a seperate question. http://stackoverflow.com/questions/11100216/python-oauth2-getting-access-token Thanks! – rnk Jun 19 '12 at 15:21