We’re Still Here to Help (Even Over the Holidays!) - find out more here.
Forum Discussion
ivanhigueram
7 years agoExplorer | Level 4
[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
- 9krausec5 years agoExplorer | Level 4
Greg - Thank you again. No errors were returned. Just states that status is "in-progress"
UploadSessionFinishBatchJobStatus('in_progress', None)
I'll tell ya what - You follow me through here to the end and I bet this is going to be an excellent reference for everyone else using Python. I'm actually surprised I wasn't able to find a working example in this forum, or in the examples on git.
In the meantime I'll keep at it. - Greg-DB5 years ago
Dropbox Community Moderator
9krausec That indicates that the job is not done yet. You'll need to poll it until it's complete. That is, call it once every few seconds until it returns the result.
About 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!