I'm using the /delta feature to find whether anything has changed in the Dropbox account.
When I run it for the first time (till 'has_more' becomes False), it's fine. But when I run it again (with the cursor from the previous call), it shows a list of files. I run it again (without changing any file), and I still get the same list of files (although they hadn't changed). I figured that these files were in a shared folder. I tested again with a new set of files in that folder and I get the same result -- these files show up in the delta entries although they weren't changed.
What's wrong?
I feel this is a bug. Any way to get around it?
Edit: Here's the code
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
It looks like your code is using self.cursor = delta['cursor']
when it should be using self.cursor = delt['cursor']
.