In this Data Era Storing, Managing, and organizing the Data is an important factor considered by every business. Dropbox is one of the most popular cloud storage systems on the market, and it continues to improve its features. In this article, we will be demonstrating how one can connect to dropbox API using Python and perform Storage Automation efficiently.
Get Secret Key to Connect To Your Dropbox
- Go to https://www.dropbox.com/developers/apps/create, You will see a Page like this. Select the “Scoped Access” option and in step 2 select “Full Dropbox”, Name your app with any significant name.
- In the Oauth2 Section, Set Access Token Expiration to “No Expiration“, generate an Access Token.
- Go to Permissions Tab, Select Appropriate Permissions that are required, and click Submit.
- With The Token Key Generated from the Above steps, We can use this token to connect to dropbox and perform storage Automation. You can install the python library using the below command:
pip install dropbox
Demonstration video to generate a token:
Using the token key to connect to Dropbox:
Use the token generated to connect to dropbox and create an object.
Connected to Dropbox successfully
We have successfully connected to Dropbox. We can now list folders/files, read files, upload files, delete files, etc.
Listing Files in a Folder
First, call the above method to connect and create a dropbox object, then assign a path for the folder to be scanned, then iterate through the older using file_list_folder() method and for a loop.
Now we have successfully connected to dropbox using python, Listed the Folders present in it.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course