Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
fapb88ve
9 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...
- 9 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 Community Moderator
9 years agoThe 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)
hilaal_leo
8 years agoNew member | Level 2
Hi Greg
metadata, f = dropbox.file_download_details('/test.pdf')
out = open('test.pdf', 'wb')
out.write(f.content)
out.close()
I am getting the following error in terminal
metadata, f = dropbox.file_download_details('/test.pdf')
AttributeError: 'module' object has no attribute 'file_download_details'
Thanks in advance
- Greg-DB8 years ago
Dropbox Community Moderator
hilaal_leo The official Python SDK doesn't have a `file_download_details` method. Please refer to my earlier posts in this thread for examples of how to download files using the SDK. There's also an example included with the SDK here.
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!