如何限制Google Docs API返回的修订数量?

发布于 2024-11-25 03:09:00 字数 403 浏览 7 评论 0原文

我使用 gdata lib 在 python 中有以下代码:

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)

问题是我只需要最后的 n 修订版,而不是全部。如果我能得到自某个日期以来的所有修订,我也会很高兴。

那么,是否有可能:

  • 获取自某个日期以来的所有修订?
  • 获取最后 N 次修订?

I have the following code in python, using 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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泛泛之交 2024-12-02 03:09:00

自从我提出这个问题以来,Google 发布了一个新的 API 端点,允许这种行为:http://code.google.com/apis/documents/docs/3.0/developers_guide_protocol.html#Changes

更改源是只读源,提供有关所有资源(包括已与用户共享的资源)的所有更改的信息。当且仅当资源自给定变更标记以来发生更改时,提要的工作方式是提供每个资源的当前状态。

更改源提供了一种更有效的方法来检测资源更改。以前,开发人员重复轮询用户帐户中的所有资源,效率低且占用资源。更改源解决了这些问题,现在开发人员必须从 API 收集更少的数据来检测更新。

所以,现在我使用:

feed = self.client.GetChanges(since_changestamp)

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)
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文