It appears that uploading multiple different files to the same dropbox at the same time, is completely broken in the V2 api. Even if 2 different computers are uploading a file. Please see the following testcase:
#!/bin/env python2
import tempfile
import dropbox
FILE = ""
ACCESSTOKEN = ""
client = dropbox.Dropbox(ACCESSTOKEN)
for i in range(10000):
with tempfile.NamedTemporaryFile() as fp:
metadata, restdata = client.files_download(FILE)
fp.write(restdata.content)
fp.write("{}\n".format(i))
fp.seek(0)
client.files_upload(fp, FILE, dropbox.files.WriteMode('overwrite', None))
Steps to reproduce:
fill in your accesstoken.
fill in in the variables FILE, to a file that exists ('/foo/test.txt'). Start the program.
Change the variable FILE to another file that exists ('/foo/test2.txt'). Start another instance of the program
What should happen is that both test.txt and test2.txt are continuously appended with an new integer followed by a newline. But in practice, the files occasionally end up completely empty after an update cycle. The download of the file does not fail. client.files_upload simply creates an completely empty file.
This behavior is not reproduceable when running only one instance of this testcase. Running the testcase on one computer or on different computers/ip's with different/same accesstokens/accounts does not make a difference in my testing as long as the same dropbox (or dropbox folder?) is accessed.
Time to reproduce: about 10 updates. Might depend on your internet connection and proximity to dropbox' servers. (not tested)
Tested with dropbox 6.8.0 on windows 10 and dropbox 6.5.0 on debian. Only tested with python 2.7