If you want to upload file from or to DropBox through Raspberry Pi, it is easy to do so. The following will show you a a installation program and its setup steps.
Step 1. Setup DropBox account and apps from web
First of all you need a DropBox account and apps account through the following links. Hop on over to dropbox is free.
You then need to visit this link https://www.dropbox.com/developers/apps, login to DropBox and create an “app” by clicking the “create app” button.
Then choose “Dropbox API app”, “Files and Datastores”, and answer the final question “Can your app be limited to its own, private folder?” – either answer is OK, depending on your needs. The result will be as below:
Step 2. Set Up DropBox Uploader in Raspberry Pi
Get Dropbox Uploader onto your Pi
$ cd ~ (this ensures you are in /home/pi)
$ git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
(If this fails, you may need to install git with sudo apt-get install git-core)
You should be able to see a directory called Dropbox-Uploader
$ cd Dropbox-Uploader
You should now see three files, one of which is called dropbox_uploader.sh. This is the script we’re going to use.
Run the script with ./dropbox_uploader.sh (if it fails, try chmod +x dropbox_uploader.sh)
If access right problem still occurs, run the following command:
$ sudo ./dropbox_upload.sh
Sorting out the DropBox API keys and authorization. You need to give your app a unique name, and you will be assigned some keys to go with the name. Now you need to enter your app’s DropBox API keys and secret. Once you’ve entered your keys and answered the question “app” or “full”, your Pi will request an authorisation token and you will be given a web URL you need to visit to activate it…
The following is the whole setup screen dump from my Raspberry Pi for your reference:
pi@gopi2:~ $ git clone https://github.com/andreafabrizi/Dropbox-Uploader.git
Cloning into ‘Dropbox-Uploader’…
remote: Counting objects: 718, done.
remote: Total 718 (delta 0), reused 0 (delta 0), pack-reused 718
Receiving objects: 100% (718/718), 213.12 KiB | 190.00 KiB/s, done.
Resolving deltas: 100% (369/369), done.
Checking connectivity… done.
pi@gopi2:~ $ cd Dropbox-Uploader
pi@gopi2:~/Dropbox-Uploader $ ls
CHANGELOG.md dropbox_uploader.sh dropShell.sh LICENSE README.md
pi@gopi2:~/Dropbox-Uploader $ ./dropbox_uploader.sh
This is the first time you run this script.
1) Open the following URL in your Browser, and log in using your account: https://www.dropbox.com/developers/apps
2) Click on “Create App”, then select “Dropbox API app”
3) Now go on with the configuration, choosing the app permissions and access restrictions to your DropBox folder
4) Enter the “App Name” that you prefer (e.g. MyUploader271401743117612)
Now, click on the “Create App” button.
When your new App is successfully created, please type the
App Key, App Secret and the Permission type shown in the confirmation page:
# App key: 0pmq2laok7xxxxx
# App secret: d5fh2kgyd2xxxxx
App folder [a]: If you choose that the app only needs access to files it creates
Full Dropbox [f]: If you choose that the app needs access to files already on Dropbox
# Permission type [a/f]: a
App key is 0pmq2laok7tinna, App secret is d5fh2kgyd2uyftx and Access level is App Folder. Looks ok? [y/n]: y
Token request… OK
Please open the following URL in your browser, and allow Dropbox Uploader to access your DropBox folder:
Press enter when done…
Access Token request… OK
Finally, your DropBox account connected to your “app”
Besides Raspberry Pi operation, you also need to allow the access of Dropbox from Raspberry Pi as below two screens:
Step 3. Now you can test to upload from Raspberry Pi to DropBox
$ cd home/pi/Dropbox-Uploader
$ ./dropbox_uploader.sh upload /home/pi/upload_file_fr name_of_upload_file_to
This will upload the file you choose to your DropBox account.
…or use it in a Python script like this…
from subprocess import call
photofile = “/home/pi/Dropbox-Uploader/dropbox_uploader.sh upload /home/pi/photo00001.jpg photo00001.jpg”
call ([photofile], shell=True)
If we upload “license” & “license1″ files to Dropbox, it will show the result as below:
Finally, if you look at the DropBox Uploader documentation, there’s a lot more commands you can make use of…