Python
Overview
Install
Tutorial
Documentation
Dropbox for Python
Here’s our Python SDK for API v2, which helps you easily integrate Dropbox into your Python app.
Code
Dropbox for Python - Dropbox for Python SDK is open source on GitHub.
Sample apps
-
back-up-and-restore.py - Simple app that shows how to back up user files and restore them to a specific revision.
-
updown.py - Simple app which demonstrates how to sync a local directory with a Dropbox.
Install Dropbox for Python
To get started with Dropbox for Python, we recommend you add the SDK to your project using pip.
Install the Python SDK
Download and install the SDK.
Now you can do “import dropbox” in your Python app, or in a Python interpreter.
That’s it! Now you’re ready to get started with the tutorial.
Dropbox for Python tutorial
A good way to start using the Python SDK is to follow this quick tutorial. Just make sure you have the the Python SDK installed first!
Register a Dropbox API app
To use the Dropbox API, you’ll need to register a new app in the Developer Console. Choose Scoped access, then choose the type of access your app needs (App folder or Full Dropbox). You’ll need to use the app key created with this app to access API v2.
Link an account
In order to make calls to the API, you’ll need an instance of the Dropbox object. To instantiate, pass in the access token for the account you want to link. (Tip: You can generate an access token for your own account through the Developer Console. Open your app, go to the Settings tab, and click Generate access token.)
If your app uses team scopes and you are not a team admin, Generate access token is disabled.
Test it out to make sure you’ve linked the right account:
Try some API requests
You can use the Dropbox object you instantiated above to make API calls. Try out some of the files requests.
List all of the contents in the user’s root directory:
Upload a file (and take a wild guess at tomorrow’s headline):
Get the metadata for a file (and prove that you called it before the game was over!):
You can read more in the documentation. There’s also a sample script called “updown.py” in the examples folder. Check it out!
Dropbox for Python documentation
Here’s the full documentation for the Python SDK.