Reputation: 23
How do I query the contents of a specific collection using the Python client for Google Docs API? This is how far I've come:
client = gdata.docs.service.DocsService()
client.ClientLogin('myuser', 'mypassword')
FOLDER_FEED1 = "/feeds/documents/private/full/-/folder"
FOLDER_FEED2 = "/feeds/default/private/full/folder%3A"
feed = client.Query(uri=FOLDER_FEED1 + "?title=MyFolder&title-exact=true")
full_id = feed.entry[0].resourceId.text
(res_type, res_id) = full_id.split(":")
feed = client.Query(uri=FOLDER_FEED2 + res_id + "/contents")
for entry in feed.entry:.
print entry.title.text
The first call to Client.Query
succeeds and seems to provide a valid resource ID. The second call, however, returns:
{'status': 400, 'body': 'Invalid request URI', 'reason': 'Bad Request'}
Upvotes: 2
Views: 239
Reputation: 41663
It is much easier once you have a folder entry, to call client.GetResources(entry.content.src)
rather than generating the URI by yourself and using a Query.
In your case, client.GetResources(feed.entry[0].content.src)
.
Upvotes: 1