我试图在我的web应用程序中实现经过YouTube验证的用户视频。使用oauth我想连接到youtube apis。这里是我从github现在使用的代码https://gist.github.com/2970845用于YouTube的Python oauth
我已经使用该代码实现了vimeo api。但我不知道Youtube API。它显示这个错误时,我请求request_token
<Response [400]>
>>>r.text
u'parameter_absent\noauth_parameters_absent:oauth_consumer_key&oauth_signature_method&oauth_signature&oauth_timestamp&oauth_nonce&scope\n\n'
这是从Youtube参考https://developers.google.com/accounts/docs/OAuth_ref页样本请求。
POST /accounts/OAuthGetRequestToken HTTP/1.1
Host: www.google.com
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth
oauth_consumer_key="example.com",
oauth_signature_method="RSA-SHA1",
oauth_signature="wOJIO9A2W5mFwDgiDvZbTSMK%2FPY%3D",
oauth_timestamp="137131200",
oauth_nonce="4572616e48616d6d65724c61686176",
oauth_version="1.0"
oauth_callback="http://www.example.com/showcalendar.html"
scope="http://www.google.com/calendar/feeds http://picasaweb.google.com/data"
我不确定的是我在主要页面显示的标题。我有这样的
>>> headers
{'Authorization': u'oauth_body_hash=xxxxxxxxxxxxxxxxxxxxxxx,oauth_nonce=62215234,oauth_timestamp=1340347725,oauth_consumer_key=xxxxxxxxxxxx.apps.googleusercontent.com,oauth_signature_method=HMAC-SHA1,oauth_version=1.0,oauth_signature=xxxxxxxxxxxxxxxxxxxxxxxx,scope=https://gdata.youtube.com,oauth_callback=http://127.0.0.1:8000/information/youtube/'}
但YouTube的参考页显示,我们必须使用“授权:OAuth的”。我怎样才能在头文件中提供这个功能?
谢谢!
可能的重复http://stackoverflow.com/questions/6731966/oauth-and-the-youtube-api ?? –
@EswarRajeshPinapala我找不到我的解决方案。你能给我正确的代码吗? – rnk
我想给你的范围内的2个网址搞点东西 scope =“http://www.google.com/calendar/feeds http://picasaweb.google.com/data”你可以尝试只给日历范围? –