开发者

How to limit the number of revisions returned by Google Docs API?

I have the following code in python, us开发者_如何学Cing the gdata lib:

feed = self.client.GetDocList(uri='/feeds/default/private/full')
for entry in feed.entry:
   # get the revisions for this entry
   revisions_feed = self.client.GetRevisions(entry.resource_id.text)

The problem is that I only need the last n revisions, not all of them. I would be happy as well if I could get all the revisions since a certain date.

So, is it possible to:

  • get all the revisions since a certain date?
  • get the last N revisions?


Since I asked the question, Google released a new API endpoint that allows this behavior: http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#Changes

The changes feed is a read-only feed that provides information about all changes to all resources, including resources that have been shared with a user. The feed works by providing the current state of each resource, if and only if the resource has changed since the given changestamp.

The changes feed provides a more efficient way to detect changes to resources. Previously, developers polled all resources from a user's account repeatedly, which was inefficient and resource-intensive. The changes feed addresses these problems, and now developers must collect less data from the API to detect updates.

So, now I use:

feed = self.client.GetChanges(since_changestamp)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜