Dropbox
Last updated
Last updated
This article covers all the necessary steps to access and manage files on Dropbox from inside DataLab. The guide assumes that you already have a Dropbox account.
Sign in to your Dropbox account, head over to https://www.dropbox.com/developers/apps and click "Create app".
In the app creation form:
Select the "Scoped access" API.
Choose the type of access you need.
Specify a name for your app.
After the app is created, head over to the Permissions tab and select the correct access scopes for what you intend to do. For example, if you only want to use Workspace to programmatically read content from Dropbox, files.metadata.read
and files.content.read
is enough. Make sure to click "Submit" in the footer to persist the changes.
Go back to the settings tab, and in the OAuth 2 section click "Generate" to generate an access token. Copy the access token to your clipboard.
Securely store the access token as an environment variable in Workspace:
In your workbook, open "Environment > Environment variables..." in the menu bar, and click on "Add". You need to create a new set with one environment variable:
Set Name
to DROPBOX_ACCESS_TOKEN
In Value
paste the access token that you copied to your clipboard in the previous step.
Set the "Environment Variable Set Name" to something meaningful, e.g. "Dropbox Access Token"
Click "Create", "Next" and finally, "Connect". Your workspace session will restart, and DROPBOX_ACCESS_TOKEN
will now be available as an environment variable in your workspace session.
If you've done all of the steps above successfully, you're now ready to run some Python code to access Dropbox files! The code is available in this workspace; you can click this link to create your own copy that you can edit to your use case.