Hello,

I am using the following URL (through 2-legged OAuth with the
appropriate HTTP headers) to download a PDF of a Google Document from
the Docs List API protocol against a Premiere domain, and am receiving
an HTML file instead of a PDF:

https://docs.google.com/feeds/download/documents/Export?xoauth_requestor_id=tim%40appirio-dev1.com&docID=dgtzfgwf_0gvv925gq&format=pdf

This method successfully pulled PDF files as recently as early last
week.

For reference, here is the complete Python code that duplicates the
issue.  It is not necessary to use Python to verify the bug; it is a
server-side error.  I only include Python source for ease of
verification.

domain = 'mydomain.com'
username = 'user'
consumer_secret = 'consumer secret for mydomain.com'

email = '%...@%s' % (username, domain)
service = gdata.docs.service.DocsService()
service.SetOAuthInputParameters
(gdata.auth.OAuthSignatureMethod.HMAC_SHA1, domain,
two_legged_oauth=True, consumer_secret=consumer_secret)
entries = service.QueryDocumentListFeed
(gdata.docs.service.DocumentQuery(params={'xoauth_requestor_id':
email}).ToUri()).entry
# Verify that entries[0] is a document; otherwise, try entries[1],
etc. until you find a document
for entry in entries:
    if entry.category[0] == 'document': break
id = entry.id.text.split('%3A', 1)[1]
import urllib
params = urllib.urlencode({'docID': id, 'format': 'pdf',
'xoauth_requestor_id': email})
url = 'https://docs.google.com/feeds/download/documents/Export?%s' %
params
file = open('%s.html' % entry.title.text, 'w')
file.write(service.GetMedia(url).file_handle.read())
file.flush()
file.close()

Open the file with a web browser or text editor to reveal that it is,
indeed, an HTML file and not a PDF.

This is critical-path to a 13,000 seat Google Apps roll-out.  We are
in functional testing this week.  Please let me know through direct
email when the bug is verified and when it is fixed.

Thanks!

Tim

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Data Protocol" group.
To post to this group, send email to google-help-dataapi@googlegroups.com
To unsubscribe from this group, send email to 
google-help-dataapi+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-help-dataapi?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to