This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Upload to drop box | |
import dropbox | |
access_token = 'XXXX' | |
#upload from local to dropbox | |
file_from = 'Pics.jpg' #local file path | |
file_to = '/Pics.jpg' # dropbox path | |
def upload_file(file_from, file_to): | |
dbx = dropbox.Dropbox(access_token) | |
f = open(file_from, 'rb') | |
dbx.files_upload(f.read(), file_to) | |
upload_file(file_from,file_to) | |
#Download from drop box to local | |
dbx = dropbox.Dropbox(access_token) | |
dbx.files_download_to_file('download1.jpg', '/'+ file_from) | |
No comments:
Post a Comment