python - OAuth and the YouTube API -
python - OAuth and the YouTube API -
i trying utilize youtube services oauth. have been able obtain request tokens, authorize them , transform them access tokens.
now trying utilize tokens requests youtube services. instance trying add together video playlist. hence making post request to
https://gdata.youtube.com/feeds/api/playlists/xxxxxxxxxxxx
sending body of
<?xml version="1.0" encoding="utf-8"?> <entry xmlns="http://www.w3.org/2005/atom" xmlns:yt="http://gdata.youtube.com/schemas/2007"> <id>xxxxxxxxx</id> </entry> and headers
gdata-version: 2 content-type: application/atom+xml authorization: oauth oauth_consumer_key="www.xxxxx.xx", oauth_nonce="xxxxxxxxxxxxxxxxxxxxxxxxx", oauth_signature="xxxxxxxxxxxxxxxxxxx", oauth_signature_method="hmac-sha1", oauth_timestamp="1310985770", oauth_token="1%2fxxxxxxxxxxxxxxxxxxxx", oauth_version="1.0" x-gdata-key: key="xxxxxxxxxxxxxxxxxxxxxxxxx" plus standard headers (host , content-length) added urllib2 (i using python) @ moment of request.
unfortunately, error 401: unknown authorization header, , headers of response are
x-gdata-user-country: www-authenticate: googlelogin service="youtube",realm="https://www.google.com/youtube/accounts/clientlogin" content-type: text/html; charset=utf-8 content-length: 179 date: mon, 18 jul 2011 10:42:50 gmt expires: mon, 18 jul 2011 10:42:50 gmt cache-control: private, max-age=0 x-content-type-options: nosniff x-frame-options: sameorigin x-xss-protection: 1; mode=block server: gse connection: close in particular not know how interpret www-authenticate header, realm hints clientlogin.
i have tried play oauth playground , authorization header sent site looks mine, except order of fields. still, on plyaground works. well, almost: error telling developer key missing, reasonable since there no way add together 1 on playground. still, go past error 401.
i have tried manually re-create authorization header there, , got error 400: bad request.
what doing wrong?
turns out problem newline before xmlns:yt. able debug using ncat, suggeested here, , inspecting total response.
python oauth youtube youtube-api
Comments
Post a Comment