Hi

as I can see dropbox.client.DropboxClient.put_file has four parameters:

"
    full_path
        The full path to upload the file to, including the file name. If the 
destination folder does not yet exist, it will be created.
    file_obj
        A file-like object to upload. If you would like, you can pass a string 
as file_obj.
    overwrite
        Whether to overwrite an existing file at the given path. (Default 
False.) If overwrite is False and a file already exists there, Dropbox will 
rename the upload to make sure it doesn't overwrite anything. You need to check 
the metadata returned for the new name. This field should only be True if your 
intent is to potentially clobber changes to a file that you don't know about.
    parent_rev
        Optional rev field from the 'parent' of this upload. If your intent is 
to update the file at the given path, you should pass the parent_rev parameter 
set to the rev value from the most recent metadata you have of the existing 
file at that path. If the server has a more recent version of the file at the 
specified path, it will automatically rename your uploaded file, spinning off a 
conflict. Using this parameter effectively causes the overwrite parameter to be 
ignored. The file will always be overwritten if you send the most recent 
parent_rev, and it will never be overwritten if you send a less recent one.
"

What is the purpose of file_obj parameter?

f = open('working-draft.txt', 'rb')
response = client.put_file('/magnum-opus.txt', f)
print "uploaded:", response

In the example above there are two files working-draft.txt and magnum-opus.txt.
If I want to upload magnum-opus.txt, why do I need working-draft.txt?

Furthermore, if I want to update the file, how to find out parent_rev parameter?

As you can see I am a little bit confused. :)

Regards.
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to