Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

ivanhigueram's avatar
ivanhigueram
Explorer | Level 4
7 years ago

[Python V2] How to do batch upload?

Hi! 

I am trying to upload several files using the sessions and batch operators in the Dropbox SDK for Python. I'm trying to do something like this: 

dbx = dropbox.Dropbox(<API KEY>)

commit_info = []
for df in list_pandas_df: 
    df_raw_str = df.to_csv(index=False)
    upload_session = dbx.upload_session_start(df_raw_str.encode())
    commit_info.append(
dbx.files.CommitInfo(path=/path/to/db/folder.csv
) dbx.files_upload_finish_batch(commit_info)

But, I do not completely understand from the documentation, how should I pass the commit data and the session info to the "files_upload_session_finish_batch" function. The "files_upload_session_finish" function does allow a commit and a cursor, while the documentation states that the batch option only takes a list of commits. 

My files are not particularly big, but they are numerous. That's why I'm not using any of the appending options. Should I use any cursor? I'm a little bit lost here :( 

12 Replies

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!