google-code-export / gdata-python-client

Automatically exported from code.google.com/p/gdata-python-client
1 stars 0 forks source link

Youtube client always throws RequestError (302 Moved) #367

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
>>> import gdata.youtube
>>> import gdata.youtube.service
>>> yt_service = gdata.youtube.service.YouTubeService()
>>> yt_service.GetMostLinkedVideoFeed()

What is the expected output? What do you see instead?

Expected:
A list of most liked videos.

Actual:
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.6/site-packages/gdata/youtube/service.py", line 548, in 
GetMostLinkedVideoFeed
    return self.GetYouTubeVideoFeed(YOUTUBE_STANDARD_MOST_LINKED_URI)
  File "/Library/Python/2.6/site-packages/gdata/youtube/service.py", line 181, in 
GetYouTubeVideoFeed
    return self.Get(uri, converter=gdata.youtube.YouTubeVideoFeedFromString)
  File "/Library/Python/2.6/site-packages/gdata/service.py", line 1097, in Get
    encoding=encoding, converter=converter)
  File "/Library/Python/2.6/site-packages/gdata/service.py", line 1097, in Get
    encoding=encoding, converter=converter)
  File "/Library/Python/2.6/site-packages/gdata/service.py", line 1097, in Get
    encoding=encoding, converter=converter)
  File "/Library/Python/2.6/site-packages/gdata/service.py", line 1097, in Get
    encoding=encoding, converter=converter)
  File "/Library/Python/2.6/site-packages/gdata/service.py", line 1105, in Get
    'body': result_body}
gdata.service.RequestError: {'status': 302, 'body': '<HTML><HEAD><meta 
http-equiv="content-
type" content="text/html;charset=utf-8">\n<TITLE>302 
Moved</TITLE></HEAD><BODY>\n<H1>302 Moved</H1>\nThe document has moved\n<A 
HREF="http://www.google.com">here</A>.\r\n</BODY></HTML>\r\n', 'reason': 
'Redirect 
received, but redirects_remaining <= 0'}

What version of the product are you using?
2.0.10 from Pypi.

I may get something really wrong here but I just don't understand this behavior.
I get this error message on every request. 
Thanks.

Original issue reported on code.google.com by kai.kue...@gmail.com on 17 May 2010 at 11:39

GoogleCodeExporter commented 9 years ago
I've noticed the same behavior, but with the PhotosService GetFeed method. The 
exact 
same code does not raise an exception when using the gdata 2.0.9 library.

Traceback (most recent call last):
  File "google-cl.py", line 280, in <module>
    main()
  File "google-cl.py", line 274, in main
    run_once(options, args)
  File "google-cl.py", line 208, in run_once
    task.run(client, options, args)
  File "/home/orignihn/google/googlecl/trunk/src/picasa/service.py", line 270, in 
_run_list
    query=options.encoded_query)
  File "/home/orignihn/google/googlecl/trunk/src/picasa/service.py", line 62, in 
build_entry_list
    album_entry = self.GetAlbum(user=user, title=title)
  File "/home/orignihn/google/googlecl/trunk/src/picasa/service.py", line 162, in 
GetAlbum
    return self.GetEntries(uri, title)
  File "/home/orignihn/google/googlecl/trunk/src/util.py", line 74, in GetEntries
    f = self.GetFeed(uri)
  File "/usr/local/lib/python2.6/dist-packages/gdata/photos/service.py", line 179, in 
GetFeed
    raise GooglePhotosException(e.args[0])
gdata.photos.service.GooglePhotosException: (302, 'Redirect received, but 
redirects_remaining <= 0', '<HTML><HEAD><meta http-equiv="content-type" 
content="text/html;charset=utf-8">\n<TITLE>302 
Moved</TITLE></HEAD><BODY>\n<H1>302 
Moved</H1>\nThe document has moved\n<A 
HREF="http://www.google.com">here</A>.\r\n</BODY></HTML>')

Original comment by tom.h.mi...@gmail.com on 19 May 2010 at 8:49

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I am getting the same error with gdata.youtube.service.YouTubeService in the 
latest 
(2.0.10) version of gdata library.

Switching to previous version (2.0.9) fixed this problem for me.

Original comment by redvas...@gmail.com on 25 May 2010 at 4:28

GoogleCodeExporter commented 9 years ago
Switching to version 2.0.9 hasn't changed anything for me and isn't an option 
anyway.

Original comment by Quas...@googlemail.com on 25 May 2010 at 4:29

GoogleCodeExporter commented 9 years ago
Try setting the ssl property of your YouTubeService object to false. We just 
updated the Python Developer's Guide 
to reflect this:

  http://code.google.com/apis/youtube/1.0/developers_guide_python.html#GettingStarted

Recent releases of the Python client library assume that all Google Data 
services are accessible via HTTPS, which 
is not the case for the YouTube API.

Original comment by api.je...@gmail.com on 27 May 2010 at 5:34

GoogleCodeExporter commented 9 years ago
Works for me!

As an interesting side-note, before making the change, I was getting the 
following 
new and exciting traceback:

...(truncated)...
  File "/usr/local/lib/python2.6/dist-packages/atom/__init__.py", line 127, in 
CreateClassFromXMLString
    tree = ElementTree.fromstring(xml_string)
  File "<string>", line 85, in XML
SyntaxError: syntax error: line 1, column 0

but setting ssl to False cleared this up.

Original comment by tom.h.mi...@gmail.com on 27 May 2010 at 6:33

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
New error see above. Does not work for me.

Original comment by kai.kue...@gmail.com on 28 May 2010 at 11:24

GoogleCodeExporter commented 9 years ago
I have got the same problem with gdata.codesearch.service

Original comment by zlhe...@gmail.com on 30 Jun 2010 at 9:58

GoogleCodeExporter commented 9 years ago
same problem with docs service

Original comment by fris...@gmail.com on 1 Aug 2010 at 11:59

GoogleCodeExporter commented 9 years ago
I fixed the problem in DocsService, and it appears to be that YouTube is fixed 
too.  Please open individual bugs for other clients that may be exhibiting this 
issue.

Original comment by vicfry...@google.com on 20 Dec 2010 at 4:57