cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Update: Find information on Dropbox support during COVID-19 here
Close

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted

To upload a file I use "client.put_file(filename, f)" what should I use to download?

Helpful | Level 6

Hi, I'm uploading files to Dropbox from an Arduino Yun using the Python.

 

This is the code (working fine) I use to upload

 

# -*- coding: utf-8 -*-
import dropbox
import datetime
suffix = datetime.datetime.now().strftime("%Y%m%d%H%M")
filename = suffix + ".jpg"
client = dropbox.client.DropboxClient('my token here')
f = open('/mnt/sda1/pic.jpg', 'rb')
response = client.put_file(filename, f)
print "uploaded:", response

can you please show me the equivalent to download a file named "myfile.txt" an store it with the same name on the Yun's directory "/mnt/sda1/"

 

Many thanks in advance

1 Accepted Solution

Accepted Solutions
Highlighted

Re: To upload a file I use "client.put_file(filename, f)" what should I use to download?

Dropboxer
Dropboxer

The 'dropbox.client' functionality you're using is actually for the deprecated API v1. You should update to the latest version and use it as documented here, which uses API v2.

 

To upload a file, you would use files_upload. To download a file you would use files_download or files_download_to_file. There's an example that showing uploading and downloading.

View solution in original post

2 Replies 2
Highlighted

Re: To upload a file I use "client.put_file(filename, f)" what should I use to download?

Super User II
Super User II
*moves to API forum*

 


- - -


Heart Did this post help you? If so please mark it for some Kudos below. 


 Did this post fix your issue/answer your question? If so please press the 'Accept as Solution' button to help others find it.


 Did this post not resolve your issue? If so please give us some more information so we can try and help - please remember we cannot see over your shoulder so be as descriptive as possible! 


 

Highlighted

Re: To upload a file I use "client.put_file(filename, f)" what should I use to download?

Dropboxer
Dropboxer

The 'dropbox.client' functionality you're using is actually for the deprecated API v1. You should update to the latest version and use it as documented here, which uses API v2.

 

To upload a file, you would use files_upload. To download a file you would use files_download or files_download_to_file. There's an example that showing uploading and downloading.

View solution in original post

Polls
Do you know how to organize your files and folders?
We have created a guide on folder best practice, so you can get organized now check it out here.

Work Smarter with Dropbox

The way we work is changing. Share and discover new ways to work smarter with Dropbox in our community.

Sound good? Let's get started.
Who's talking

Top contributors to this post

What do Dropbox user levels mean?
Need more support?