Latest commit 4e21479 Oct 28, 2016 Eric Zhang committed with braincore Pass file data instead of file handle to upload

Backup And Restore

A Dropbox API sample app for the Python SDK

How to run

Make sure you've installed the Dropbox Python SDK by following the installation instructions ( ).

Then, find this line in and modify it to include your own access token. TOKEN = ''

From the example/backup-and-restore directory, run the script. python

You should see the file my-file-backup.txt show up in the Dropbox account you used to get the access token.



  1. Back up a file ("my-file.txt") The my-file.txt file is a simple file that could be any kind of app or user data. In this example, it contains a simple string of text (initially "original").

  2. Restore a file to a previous version (using /revisions)

API usage

New v2 endpoints

This app uses the Dropbox API v2 endpoints files_upload, files_restore, files_download_to_file, and files_list_revisions. See more here:

Error checking

This example also shows you how to do specific error handling with the new API v2 exceptions. In the backup() function, you can see how to check for a specific kind of API Error.