google-code-export / gdata-python-client

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

302 Redirected not being handled when opening "new-style" Docs #451

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Using the API, Export() a Document

What is the expected output? What do you see instead?
The API should automatically handle the redirect for me and download the 
requested document.
I instead get a 302, which then becomes an Exception.

What version of the product are you using?
2.0.12

Please provide any additional information below.

The following stack-trace:

gd_client.Export(doc.resourceId.text, tmp_path.encode(self.codec))
  File "/usr/local/lib/python2.6/dist-packages/gdata/docs/service.py", line 361, in Export
    self.Download(entry_or_id_or_url, file_path, ext, gid, extra_params)
  File "/usr/local/lib/python2.6/dist-packages/gdata/docs/service.py", line 340, in Download
    self._DownloadFile(url, file_path)
  File "/usr/local/lib/python2.6/dist-packages/gdata/docs/service.py", line 178, in _DownloadFile
    'body': response_body}
gdata.service.RequestError: {'status': 302, 'body': 
'<HTML>\n<HEAD>\n<TITLE>Moved Temporarily</TITLE>\n</HEAD>\n<BODY 
BGCOLOR="#FFFFFF" TEXT="#000000">\n<H1>Moved Temporarily</H1>\nThe document has 
moved <A 
HREF="http://docs.google.com/feeds/download/documents/Export?exportFormat=doc&am
p;id=1NFGV_Phwto7jaKFlr-BG6RfwQPtYJifm5K1_f-Sy8Xk">here</A>.\n</BODY>\n</HTML>\n
', 'reason': 'Moved Temporarily'}

Here is the line that calls Export:

self.gd_client.Export(doc.resourceId.text, tmp_path.encode(self.codec))

I use ProgrammaticLogin() and think this may be related to Issue 360 though I 
am aware that is marked as fixed.

Thanks in advance
Scott W

Original issue reported on code.google.com by d38dm8nw81k1ng@gmail.com on 24 Sep 2010 at 9:18

GoogleCodeExporter commented 9 years ago
It also occurs when self.gd_client.ssl = True

Also, by "New Style", I refer to documents created using the new editor: 
http://www.google.com/google-d-s/intl/en-GB/whatsnew.html

Older documents work perfectly fine.

Original comment by d38dm8nw81k1ng@gmail.com on 24 Sep 2010 at 9:27

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
You can easily reproduce this by using Run docs_example.py.  I tested with 
version 2.0.12.

The URL appears to be wrong.  I believe it should be blah blah 
documents/export/Export?exportFormat blah blah.
(notice the "export" folder).

Original comment by mhenry1...@gmail.com on 9 Nov 2010 at 5:28

GoogleCodeExporter commented 9 years ago
I can get this to repeat using docs_example.py. Working on a fix now.

Original comment by joe.gregorio@gmail.com on 17 Nov 2010 at 7:19

GoogleCodeExporter commented 9 years ago
Fixed in revision 919.  Will go out in next release of client lib.

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