蟒蛇的oauth2 - 获得访问令牌 [英] Python oauth2 - getting access token

查看:167
本文介绍了蟒蛇的oauth2 - 获得访问令牌的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要集成身份验证VIMEO用户的视频在我的Web应用程序。我有这个code https://gist.github.com/2944212

I want to integrate authenticated vimeo user's videos in my web application. I have this code https://gist.github.com/2944212

我在授权调用,现在我得到的组oauth_token,oauth_token_secret,oauth_verifier 。我说这些东西对参数,并提出请求到以下网址,但现在我得到这个错误

I made authorize call and now I got oauth_token, oauth_token_secret, oauth_verifier. I added all these things to the parameter and made request to the below url, but now I'm getting this error

>>> url = 'http://vimeo.com/oauth/access_token'
>>> req = oauth.Request(method='GET', url=url, parameters=params)
>>> req.sign_request(signature_method, consumer, token)
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/usr/lib/python2.7/dist-packages/oauth2/__init__.py", line 502, in sign_request
self['oauth_signature'] = signature_method.sign(self, consumer, token)
File "/usr/lib/python2.7/dist-packages/oauth2/__init__.py", line 838, in sign
key, raw = self.signing_base(request, consumer, token)
File "/usr/lib/python2.7/dist-packages/oauth2/__init__.py", line 832, in signing_base
key += escape(token.secret)
AttributeError: 'str' object has no attribute 'secret'

使用我怎么能获取的access_token 并使得这种方法工作的 https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.getUploaded

Using that how can I fetch access_token and make this method to work https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.getUploaded

我是新来的OAuth,我需要你的帮助。

I'm new to oauth and I need your help.

谢谢!

更新

现在我解决了这个错误。我唯一​​需要的是获得访问令牌和一个脚本,以这种方法的 https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.getUploaded

Now I solved that error. The only thing I need is to get the access token and a script to make the request for this method https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.getUploaded

推荐答案

如果我理解正确,你现在有访问令牌?

If I understand correctly you now have the access token?

要发出请求API端点遵循相同的程序,但使用访问标记(如组oauth_token参数),并在req.sign方法。你直接向API URL请求藏汉当然:)

To make requests to the API endpoint follow the same procedure but use the access token (as the oauth_token parameter) and in the req.sign method. Direct your request towards the API URL aswell, of course :)

和一旦你有访问令牌,你不需要oauth_verifier。

And you don't need the oauth_verifier once you have the access token.

这篇关于蟒蛇的oauth2 - 获得访问令牌的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆