| From | Sent On | Attachments |
|---|---|---|
| Chris | Feb 19, 2009 6:27 pm | |
| Jeff Fisher | Feb 20, 2009 1:47 pm | |
| Jeff Fisher | Feb 20, 2009 1:48 pm | |
| Chris | Feb 20, 2009 8:56 pm | |
| Jeff Fisher | Feb 23, 2009 2:35 pm | |
| Chris | Feb 23, 2009 4:30 pm | |
| Jeff Fisher | Feb 24, 2009 12:48 pm | |
| Chris | Mar 1, 2009 7:28 pm | |
| Jeff Fisher | Mar 2, 2009 3:29 pm | |
| Chris | Mar 3, 2009 11:32 am | |
| Jeff Fisher | Mar 3, 2009 1:23 pm | |
| Chris | Mar 4, 2009 9:31 pm | |
| Jeff Fisher | Mar 5, 2009 1:31 pm | |
| service G2100 | Mar 5, 2009 3:30 pm |
| Subject: | [YouTube-API] Re: Using OAuth, YouTube, and direct uploading | |
|---|---|---|
| From: | Chris (macm...@gmail.com) | |
| Date: | Mar 3, 2009 11:32:50 am | |
| List: | com.googlegroups.youtube-api-gdata | |
Hey Jeff,
Thanks for the example. Looks pretty close to what I came up with.
questions:
I applied for OAuth keys here: https://www.google.com/accounts/ManageDomains
I applied for other youtube keys here:
http://code.google.com/apis/youtube/dashboard/productSignup
Do I need all 4 of them?
According to the sample gdata tests located here: http://code.google.com/p/gdata-python-client/source/browse/trunk/samples/oauth/oauth_example.py client_id and developer keys are not used at all. I thought that the client_id and developer_key were used when you are using AuthSub which would be why I am getting AuthSub Errors.
When passing in call for keys oauth_key, oauth_secret, client_id, developer_key I get this error: Traceback (most recent call last): File "pastie-405328.py", line 76, in <module> main() File "pastie-405328.py", line 74, in main uploadVideo() File "pastie-405328.py", line 67, in uploadVideo new_entry = client.InsertVideoEntry(video_entry, video_file_location) File "/usr/lib/python2.5/site-packages/gdata/youtube/service.py", line 653, in InsertVideoEntry raise YouTubeError(e.args[0]) gdata.youtube.service.YouTubeError: {'status': 401, 'body': '<HTML> \n<HEAD>\n<TITLE>Token invalid - Invalid AuthSub token.</TITLE>\n</ HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Token invalid - Invalid AuthSub token.</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Token invalid - Invalid AuthSub token.'}
When passing in oauth_secret and oauth_secret into client_id and developer key, I get this error: Traceback (most recent call last): File "pastie-405328.py", line 76, in <module> main() File "pastie-405328.py", line 74, in main uploadVideo() File "pastie-405328.py", line 67, in uploadVideo new_entry = client.InsertVideoEntry(video_entry, video_file_location) File "/usr/lib/python2.5/site-packages/gdata/youtube/service.py", line 653, in InsertVideoEntry raise YouTubeError(e.args[0]) gdata.youtube.service.YouTubeError: {'status': 403, 'body': '<HTML> \n<HEAD>\n<TITLE>Invalid developer key</TITLE>\n</HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Invalid developer key</H1> \n<H2>Error 403</H2>\n</BODY>\n</HTML>\n', 'reason': 'Invalid developer key'}
When passing in only oauth_secret and oauth_secret and commenting out client_id and developer_key I get this error: Traceback (most recent call last): File "pastie-405328.py", line 76, in <module> main() File "pastie-405328.py", line 74, in main uploadVideo() File "pastie-405328.py", line 67, in uploadVideo new_entry = client.InsertVideoEntry(video_entry, video_file_location) File "/usr/lib/python2.5/site-packages/gdata/youtube/service.py", line 653, in InsertVideoEntry raise YouTubeError(e.args[0]) gdata.youtube.service.YouTubeError: {'status': 401, 'body': '<HTML> \n<HEAD>\n<TITLE>Token invalid - Invalid AuthSub token.</TITLE>\n</ HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Token invalid - Invalid AuthSub token.</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Token invalid - Invalid AuthSub token.'}
Any suggestions?
Thanks
On Mar 2, 3:29 pm, Jeff Fisher <jfis...@youtube.com> wrote:
Alright Chris, I finally sat down and battled this beast. I think your idea of wrapping this insanity is a very good one.
Here's what I did:
So I broke this process down into three parts (getting the request token, upgrading it, and performing the upload) and after each step I saved the resulting tokens by printing them out and hard-coding them back in to the test script for use later. It is important is having the full " oauth_token_secret=blahblah&oauth_token=blahblah" text and not just snipping out the value of oauth_token.
Hopefully you can extrapolate from the link above what you need to do. Let me know if part of it gets you lost.
Cheers, -Jeff
On Sun, Mar 1, 2009 at 7:29 PM, Chris <macm...@gmail.com> wrote:
Hey Jeff,
Here is the latest revision of my code: http://dpaste.com/4393/
I call the methods that you describe but now I get this error:
Traceback (most recent call last): File "<stdin>", line 3, in <module> File "youtubeapi.py", line 85, in upload_video return self.gd_client.InsertVideoEntry(video_entry, file_location) File "/usr/lib/python2.5/site-packages/gdata/youtube/service.py", line 653, in InsertVideoEntry raise YouTubeError(e.args[0]) gdata.youtube.service.YouTubeError: {'status': 401, 'body': '<HTML> \n<HEAD>\n<TITLE>Token invalid - Invalid AuthSub token.</TITLE>\n</ HEAD>\n<BODY BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Token invalid - Invalid AuthSub token.</H1>\n<H2>Error 401</H2>\n</BODY>\n</HTML>\n', 'reason': 'Token invalid - Invalid AuthSub token.'}
Why would this happen when I am dealing with OAuth? Am I passing in the correct scope(s)?
Thanks
On Feb 24, 12:48 pm, Jeff Fisher <jfis...@youtube.com> wrote:
According to the PyDocs I guess you need to pass it an object instead of a string:
The object that needs to get passed:
It seems like your code isn't quite complete though - I'm not seeing how you are calling UpgradeToOAuthAccessToken() after the user authorizes the
token.
Cheers, -Jeff
On Mon, Feb 23, 2009 at 4:31 PM, Chris <macm...@gmail.com> wrote:
Hey Jeff, thanks for responding here is what I do: http://dpaste.com/378/ I created a thin wrapper around the gdata library.
I am not sure what I am doing wrong but here is the latest error:
Traceback (most recent call last): File "<stdin>", line 1, in <module> File "youtubeapi.py", line 73, in upload_video return self.gd_client.InsertVideoEntry(video_entry, file_location) File "/usr/lib/python2.5/site-packages/gdata/youtube/service.py", line 651, in InsertVideoEntry converter=gdata.youtube.YouTubeVideoEntryFromString) File "/usr/lib/python2.5/site-packages/gdata/service.py", line 1147, in Post media_source=media_source, converter=converter) File "/usr/lib/python2.5/site-packages/gdata/service.py", line 1215, in PostOrPut multipart[2]], headers=extra_headers) File "/usr/lib/python2.5/site-packages/atom/service.py", line 176, in request return auth_token.perform_request(self.http_client, operation, url, AttributeError: 'unicode' object has no attribute 'perform_request'
Any thoughts?
Thanks
On Feb 23, 2:36 pm, Jeff Fisher <jfis...@youtube.com> wrote:
Ah and if you do
yt_service.SetOAuthToken(access_token)
It gives you a 401 error?
Cheers, -Jeff
On Fri, Feb 20, 2009 at 8:57 PM, Chris <macm...@gmail.com>
wrote:
I am past this part as I originally posted:
I have successfully authorized the user and retrieved the the
access_token
Typically how this works is once you get the access_token you store it somewhere so that resources can be accessed at a later point.
I am at the later point, where you must pass in the user token so that you can be authorized to upload the video to the users account. The problem is that I don't know how to pass this information through. there are examples for AuthSub and ClientLogin but none for OAuth. Here is the link that I am referring to:
Does this better clarify what I am trying to do?
thanks
On Feb 20, 1:49 pm, Jeff Fisher <jfis...@youtube.com> wrote:
Blah, wrong line copypasta.
self.gd_client.UpgradeToOAuthAccessToken()
Or are you getting this far and the direct upload call isn't
working?
Cheers, -Jeff
On Fri, Feb 20, 2009 at 1:47 PM, Jeff Fisher <
jfis...@youtube.com>
wrote:
If you look at the sample:
This line looks like what you'd need to do:
self.gd_client.token_store.find_token(request_token.scopes[0]))
Cheers, -Jeff
On Thu, Feb 19, 2009 at 6:27 PM, Chris <macm...@gmail.com
wrote:
Hello, I have successfully authorized the user and retrieved
the
the
access_token via OAuth but an having issues with attempting to authorize the direct uploading request.
I am using the python gdata libraries and I was wondering what
I
need
to do to pass my access_token to the YouTube services module
so
that
when I upload a video without getting a 401.
does anyone know how to do this? Is there a special authorize class that I need to call before I attempt to upload a video?
Thanks in advance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"YouTube APIs Developer Forum" group.
To post to this group, send email to yout...@googlegroups.com
To unsubscribe from this group, send email to
youtube-api-gdata+unsu...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/youtube-api-gdata?hl=en
-~----------~----~----~----~------~----~------~--~---





