Dropbox:/ delta和共享文件夹

时间:2013-07-18 11:23:44

标签: python dropbox dropbox-api delta

我正在使用/ delta功能查找Dropbox帐户中是否有任何更改。

当我第一次运行它(直到'has_more'变为False)时,它没问题。但是当我再次运行它(使用前一次调用的光标)时,它会显示一个文件列表。我再次运行它(不更改任何文件),我仍然得到相同的文件列表(虽然它们没有改变)。我想这些文件都在共享文件夹中。 我再次使用该文件夹中的一组新文件进行测试,结果相同 - 这些文件显示在delta条目中,尽管它们没有更改。

怎么了?

我觉得这是一个错误。有办法解决它吗?

编辑: 这是代码

def getDeltaEntries(self): #this function is a method of a class
    def _getDelta():
        delta = self.client.delta(self.cursor)
        entries = delta.get('entries')
        has_more = delta.get('has_more')
        self.cursor = delta['cursor']

        while has_more:
            delt = self.client.delta(self.cursor)
            entries.extend(delta.get('entries'))
            has_more = delt.get('has_more')
            self.cursor = delta['cursor']
        return entries
    #workaround: query for delta twice and if the result is the same both times, 
    #it implies there's no change

    ent1 = _getDelta()
    ent2 = _getDelta()
    if ent1 == ent2:
        entries = []
    else:
        entries = ent1
    return entries

1 个答案:

答案 0 :(得分:2)

当代码使用self.cursor = delta['cursor']时,您的代码似乎正在使用self.cursor = delt['cursor']