Sunday, November 20, 2011

Untangling gdata

Update (2 Feb 2012): We got docs uploads working in GoogleCL with python gdata versions 2.0.15 and 2.0.16 after noticing a random page in Japanese (thanks Google Translate!) that mentioned changing all references of gdata.docs.data.DocsEntry to gdata.data.GDEntry. Also, the gdata.docs.data.MIMETYPES variable that was provided "for your convenience" went missing in 2.0.15 and 2.0.16.  I've updated the table accordingly.

A brief history of python-gdata to upload files to Google Docs.  (Much of this is also relevant to the other language interfaces to Google's gdata API.)  Coila from the "Let's Get Technical" blog (where she has more details and links) and I worked all this out this evening trying to sort through some of the nastier open GoogleCL bugs.

Versions of python-gdata (as it's known in debian/ubuntu, or gdata-python-client on the code.google.com site):

2.0.0 .. 2.0.4: Uses old OAuth mechanism.  Supports uploading limited file types to docs.

2.0.5: client.py interface added.  Uses a new OAuth mechanism.

2.0.8: "Resumable upload" mechanism added.

2 May 2011:
Google starts allowing uploading arbitrary files to Google Docs.  I believe this worked on versions 2.0.5 through 2.0.14 (2.0.15 wasn't released yet).

30 September 2011: 
Google servers start returning "403.4 SSL Required" errors for versions 2.0.5 through 2.0.9, and also 2.0.11 for some reason.  2.0.10, 2.0.12, 2.0.13 and 2.0.14 seem to be fine.

Also, "403 Files must be uploaded using the resumable upload mechanism" errors start appearing.  But only, apparently for versions 2.0.5 and later -- 2.0.0 through 2.0.5 still are able to upload limited file types.

One last wrinkle: GoogleCL is currently broken with version 2.0.15, failing due to gdata.docs.MIMETYPES having gone missing.  So I don't yet know anything more about it.

Got all that?  Here's a handy chart to help you keep it straight:


python-gdata versionOAuthCan upload text files to docs as of 11/2011Can upload arbitrary files to docs as of 11/2011Arbitrary file upload without Resumable (5/2011 - 10/2011) ??Supports Resumable Uploads403: SSL error403: Resumable upload requiredHas gdata.docs.MIMETYPESDocsEntry/GDEntry
2.0.0oldX
2.0.1oldX
2.0.2oldX
2.0.3oldX
2.0.4oldX
2.0.5newXXXXDocsEntry
2.0.6newXXXXDocsEntry
2.0.7newXXXXDocsEntry
2.0.8newXXXXXDocsEntry
2.0.9newXXXXXDocsEntry
2.0.10newXXXXXXDocsEntry
2.0.11newXXXXXDocsEntry
2.0.12newXXXXXXDocsEntry
2.0.13newXXXXXXDocsEntry
2.0.14newXXXXXXDocsEntry
2.0.15newXX?XXGDEntry
2.0.16newXX?XXGDEntry