You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
fapb88ve
8 years agoExplorer | Level 4
Downloading a file from using the Python Dropbox API
Hello,
Sorry for the basic question. I'm updating the code I had for the V1 Python API and I'm having a trouble with the download function. Originally I used the following:
f, metadata = clie...
- 8 years ago
The files_download method is the closest to what you were using. The files_download_to_file method takes an extra parameter for saving the file locally for you.
So either of these should be equivalent to your old code:
metadata, f = dbx.files_download('/'+ j) out = open(j, 'wb') out.write(f.content) out.close()
or just
dbx.files_download_to_file(j, '/'+ j)
Greg-DB
Dropbox Staff
The files_download method is the closest to what you were using. The files_download_to_file method takes an extra parameter for saving the file locally for you.
So either of these should be equivalent to your old code:
metadata, f = dbx.files_download('/'+ j) out = open(j, 'wb') out.write(f.content) out.close()
or just
dbx.files_download_to_file(j, '/'+ j)
JatinSingh2012
7 years agoNew member | Level 2
Hi Greg,
I am currently reading multiple files by a for loop and I dont want to keep saving these pdfs on my desktop and then reading them. Is there a way around this where I dont need to download the file?
- Greg-DB7 years agoDropbox Staff
JatinSingh2012 Yes, you can use the files_download method to read the file data without saving it to the local filesystem, like the example here.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,885 PostsLatest Activity: 3 hours agoIf 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 or Facebook.
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!