2012-06-19 92 views
1

我想將已驗證的vimeo用戶視頻集成到我的Web應用程序中。我有這樣的代碼https://gist.github.com/2944212Python oauth2 - 獲取訪問令牌

我做了授權電話,現在我得到組oauth_token,oauth_token_secret,oauth_verifier。我添加了所有這些東西的參數,並提出請求到以下網址,但現在我得到這個錯誤

>>> 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

我是oauth的新手,我需要你的幫助。

謝謝!

UPDATE

現在我解決了這個錯誤。我唯一需要的是獲取訪問令牌和一個腳本來提出請求,以便爲此方法提供請求https://developer.vimeo.com/apis/advanced/methods/vimeo.videos.getUploaded

回答

1

如果我理解正確,您現在有訪問令牌?

要向API端點發出請求,請遵循相同的過程,但使用訪問令牌(作爲oauth_token參數)和req.sign方法。直接向API網址發送請求,當然:)

一旦你有訪問令牌,你不需要oauth_verifier。

+0

嘿,它工作。謝謝! – rnk

+0

酷,我的榮幸。 –

+0

請檢查這個問題http://stackoverflow.com/questions/11151595/python-oauth-for-youtube – rnk

相關問題