How to use Dropbox on your Raspberry / Utiliser Dropbox


22 posts
by chteuchteu » Tue Oct 30, 2012 5:11 pm
Hello !

I has been searching all the week about how to use Dropbox on the Raspberry Pi. Actually, there isn't any officiel RaspberryPi - compatible client... (because of the ARM architecture).

So I created an article (writting in French, sorry) about how to get Dropbox on your Raspberry. There are only two solutions:
- Owncloud 4.5 (but it does not download the files on the SD card or any external drive, just make it accessible from the web interface)
- Bash Dropbox Uploader

Here is the entire article.
Please say it if you have any other way to use Dropbox on the Raspberry ! (or even any other way to sync files between two folders, excluding FTP, SFTP, ...)

Thanks ! :)
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am
by billb » Tue Oct 30, 2012 5:20 pm
chteuchteu wrote:Please say it if you have any other way to use Dropbox on the Raspberry !


http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/
(This method requires a machine running Dropbox that is accessible to the Pi via SSH)
User avatar
Posts: 177
Joined: Wed Sep 19, 2012 10:27 pm
by MattHawkinsUK » Tue Oct 30, 2012 5:31 pm
You can also use Python. Dropbox provide a Python SDK.
My Raspberry Pi blog and home of the BerryClip Add-on board : http://www.raspberrypi-spy.co.uk/
Follow me on Google+, Facebook, Pinterest and Twitter (@RPiSpy)
User avatar
Posts: 531
Joined: Tue Jan 10, 2012 8:48 pm
Location: UK
by chteuchteu » Tue Oct 30, 2012 5:38 pm
billb wrote:
chteuchteu wrote:Please say it if you have any other way to use Dropbox on the Raspberry !


http://mitchtech.net/dropbox-on-raspberry-pi-via-sshfs/
(This method requires a machine running Dropbox that is accessible to the Pi via SSH)


Yeah I also read that... But I replaced my old server with my Raspberry, so I don't have any computer running Dropbox anymore...
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am
by meltwater » Tue Oct 30, 2012 7:25 pm
I've tended to use AllwaySync and Dropbox running on a pc and sync the raspberry pi folder shared via the network.

It is crude, but works well enough (and doesn't put the overhead on the Rpi).

A native client would be good though.
______________
http://www.themagpi.com/
A Magazine for Raspberry Pi Users
Read Online or Download for Free.

My new book: goo.gl/dmVtsc

Meltwater's Pi Hardware - pihardware.com

Like the MagPi? @TheMagP1 @TheMagPiTeam
User avatar
Posts: 1013
Joined: Tue Oct 18, 2011 11:38 am
by dcosmin » Fri Jan 04, 2013 2:51 am
Personally, I use a service that allows WebDav access to Dropbox (otixo.com) then: mount the webdav folder on my raspberry pi (davfs2 package is needed) and call a synchronization script from crontab, so the files are saved and sync-ed locally to a hard disk periodically.
Unfortunately the service is free only up to 2 gb monthly transfer, but the advantage is one can add almost any cloud storage account (gdrive, box etc.)
Posts: 6
Joined: Sat Aug 11, 2012 12:53 pm
by jurafxp » Sun Jan 06, 2013 7:38 pm
Hi,
I have found the bash script, which is using DropBox API to download/upload files, maybe it will be interesting to you. Its very easy to setup and use.

https://github.com/andreafabrizi/Dropbox-Uploader
Posts: 2
Joined: Thu Dec 27, 2012 12:41 pm
by chteuchteu » Sun Jan 06, 2013 9:06 pm
Yes, this is one of the solutions I've put on the article (http://www.chteuchteu.com/2012/10/30/ra ... a-dropbox/) :)
Thanks anyway!

jurafxp wrote:Hi,
I have found the bash script, which is using DropBox API to download/upload files, maybe it will be interesting to you. Its very easy to setup and use.

https://github.com/andreafabrizi/Dropbox-Uploader
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am
by meltwater » Mon Jan 07, 2013 9:57 am
Looks like a good solution, will try to find some time to try it out!

Would be worth featuring in the MagPi if it works well.
______________
http://www.themagpi.com/
A Magazine for Raspberry Pi Users
Read Online or Download for Free.

My new book: goo.gl/dmVtsc

Meltwater's Pi Hardware - pihardware.com

Like the MagPi? @TheMagP1 @TheMagPiTeam
User avatar
Posts: 1013
Joined: Tue Oct 18, 2011 11:38 am
by advanced » Mon Jan 07, 2013 10:00 am
I wrote a small tutorial for beginners to make a shared folder with ssh simulating dropbox. I hope it helps someone :!: http://pikiosk.tumblr.com/post/39853365308/raspberry-dropbox-sftp-mac :!:

Image
Posts: 36
Joined: Mon Dec 10, 2012 6:34 pm
Location: Rome
by sheridan0309 » Wed Jan 23, 2013 3:17 am
The Pi is a perfect platform to leverage cloud storage. No port of the Dropbox client for ARM is currently planned (per the Dropbox website). I suggest logging into Dropbox via web browser and voting for that feature here:

https://www.dropbox.com/votebox/8029/raspberry-pi-arm-port

You are allowed 6 feature votes per month, so let's get the vote out!
User avatar
Posts: 1
Joined: Wed Jan 23, 2013 3:04 am
by hadi » Wed Jan 23, 2013 3:26 am
Posts: 29
Joined: Fri Jun 15, 2012 4:28 pm
by vaslabs » Fri Feb 01, 2013 12:23 pm
Create an app for your dropbox account and use this:
http://vaslabs.blogspot.co.uk/2013/01/a ... rrypi.html
Ideally you can contribute via sourceforge.net, so we can create a much better client for our raspberrys.
Thanks,
Vasilis
FOSS and Linux hobbyist and enthusiast
Posts: 6
Joined: Fri Feb 01, 2013 12:21 pm
by RolandG » Tue Feb 05, 2013 9:09 am
Hi,
found that "Dropbox Uploader" to access the Dropbox from Raspberry Pi.
http://www.webupd8.org/2013/01/dropbox-uploader-bash-script-useful-for.html
not tested yet..
Posts: 1
Joined: Tue Feb 05, 2013 9:03 am
by chteuchteu » Wed Mar 06, 2013 7:04 pm
Interesting link. But those kind of scripts just allows a limited set of functions. Example:
- script.sh -upload file.jpg
- script.sh -downlod 'file.jpg' ./
...

I don't really know if there exists a script allowing to autosync a folder with your Dropbox account... :s
Articles à propos du Raspberry Pi sur mon blog: http://www.chteuchteu.com/tag/raspberry-pi/
Posts: 22
Joined: Mon Oct 08, 2012 11:38 am
by bullen » Sat May 04, 2013 3:19 pm
Basically this is the command to upload a file:

$CURL_BIN $CURL_ACCEPT_CERTIFICATES $CURL_PARAMETERS -i --globoff -o "$RESPONSE_FILE" --upload-file "$FILE_SRC" "$API_UPLOAD_URL/$ACCESS_LEVEL/$FILE_DST?
oauth_consumer_key=$APPKEY&
oauth_token=$OAUTH_ACCESS_TOKEN&
oauth_signature_method=PLAINTEXT&
oauth_signature=$APPSECRET%26$OAUTH_ACCESS_TOKEN_SECRET&
oauth_timestamp=$time&
oauth_nonce=$RANDOM"

I will decipher more it later, and share a simpler bash script...

CURL_BIN="curl"
CURL_ACCEPT_CERTIFICATES="-k"
CURL_PARAMETERS="--progress-bar"
CURL_PARAMETERS="-s --show-error"
TMP_DIR="/tmp"
RESPONSE_FILE="$TMP_DIR/du_resp_$RANDOM"

RANDOM = just random int...
FILE_SRC = well, the file...
FILE_DST = on the other end...

API_UPLOAD_URL="https://api-content.dropbox.com/1/files_put"
ACCESS_LEVEL="dropbox"

These I don't know yet where to fetch yet:

APPKEY = This is supplied by you...
APPSECRET = This is supplied by you...

These are tricky:

OAUTH_ACCESS_TOKEN_SECRET=
OAUTH_ACCESS_TOKEN=

Code below, don't know for how long these are valid, if they should be stored or fetched every time:

OAuth is such a tragic moment in web history!

Code: Select all
time=$(utime)
    $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o $RESPONSE_FILE --data "oauth_consumer_key=$APPKEY&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26&oauth_timestamp=$time&oauth_nonce=$RANDOM" "$API_REQUEST_TOKEN_URL"
    OAUTH_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\).*/\1/p' "$RESPONSE_FILE")
    OAUTH_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)/\1/p' "$RESPONSE_FILE")

    if [ -n "$OAUTH_TOKEN" -a -n "$OAUTH_TOKEN_SECRET" ]; then
        echo -ne "OK\n"
    else
        echo -ne " FAILED\n\n Please, check your App key and secret...\n\n"
        remove_temp_files
        exit 1
    fi

    while (true); do

        #USER AUTH
        echo -ne "\n Please visit this URL from your Browser, and allow Dropbox Uploader\n"
        echo -ne " to access your DropBox account:\n\n --> ${API_USER_AUTH_URL}?oauth_token=$OAUTH_TOKEN\n"
        echo -ne "\nPress enter when done...\n"
        read

        #API_ACCESS_TOKEN_URL
        echo -ne " > Access Token request... "
        time=$(utime)
        $CURL_BIN $CURL_ACCEPT_CERTIFICATES -s --show-error --globoff -i -o $RESPONSE_FILE --data "oauth_consumer_key=$APPKEY&oauth_token=$OAUTH_TOKEN&oauth_signature_method=PLAINTEXT&oauth_signature=$APPSECRET%26$OAUTH_TOKEN_SECRET&oauth_timestamp=$time&oauth_nonce=$RANDOM" "$API_ACCESS_TOKEN_URL"
        OAUTH_ACCESS_TOKEN_SECRET=$(sed -n 's/oauth_token_secret=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE")
        OAUTH_ACCESS_TOKEN=$(sed -n 's/.*oauth_token=\([a-z A-Z 0-9]*\)&.*/\1/p' "$RESPONSE_FILE")
https://github.com/tinspin/rupy - A tiny Java async HTTP application server.
Posts: 174
Joined: Sun Apr 28, 2013 2:52 pm
by dkylep » Thu May 30, 2013 8:16 pm
Java!!

Write a java program and use the dropbox sdk
https://www.dropbox.com/developers/core/sdk

Here is a good example using the dropbox java sdk
http://aaka.sh/patel/2011/12/20/authenticating-dropbox-java-api/

I had to install java 7 on the Pi for it to compile properly. I had errors with 6.

I currently modify a text file on the Pi and every 15 minutes I upload the file to dropbox.
Posts: 4
Joined: Thu May 30, 2013 8:05 pm
by hagen » Fri Jan 10, 2014 8:18 pm
I installed SDK, created app, got app key and secret. I want to use Dropbox-Uploader from https://github.com/andreafabrizi/Dropbox-Uploader with that script:
Code: Select all
import os
path="/tmp/motion/"
def upload_files():
   if not os.path.exists(path):
       return
   dir_list = os.listdir(path)
   first_10 = dir_list[:10]
   for file_name in first_10:
       file_full_path = path + file_name
       cmd = "/home/pi/dropbox_uploader.sh upload " + file_full_path
       os.system(cmd)
       os.remove(file_full_path)

if __name__ == "__main__":
    upload_files()

and start it automatically from crontab
Code: Select all
*/5 * * * * python /home/pi/Dropbox_upload.py

But I can not understand how to make dropbox_uploader.sh work properly. Do I need to set any config for it?
Posts: 15
Joined: Sat Apr 20, 2013 8:24 am
by 1987 » Tue Jul 15, 2014 7:40 am
Hi,

Please check out my Dropbox app on GitHub @ https://github.com/JaredMHall/RaspberryCloud. It's called Raspberry Cloud. It's really simple to use and is fully featured.

You can download entire directories as zip files, view thumbnails, edit files directly in your local editor (nano, vim, emacs : P) without having to download and reupload, list files, make new directories, execute bash scripts and commands, and a whole lot more, all from within the app.

Also I wrote it as a console app with speed in mind so it performs great on the Raspberry Pi.

If like it, please leave me some feedback on my blog at http://blog.jaredmhall.com or by email at hall.jared.m@gmail.com

Thanks!
Posts: 1
Joined: Tue Jul 15, 2014 6:44 am
by rocketchef » Sat Nov 01, 2014 9:10 pm
Hello all,

Many thanks to those who've written code to solve this, very helpful to my project.

Can I make a suggestion for the future? As well as upload / download, I need a script that syncs folders, i.e. list files, check for differences, delete / download as required.

I'm not holding my breath for an ARM version of dropbox, so a basic sync script (even if it wasn't fully featured) would be awesome.
Posts: 13
Joined: Wed Oct 15, 2014 12:02 pm
by cubeofcheese » Thu Mar 05, 2015 4:47 am
When trying to set up dropbox uploader it worked perfectly fine until the authentication in which it failed, telling me to check the api key, etc. even though they were right. Any solutions?
Posts: 5
Joined: Fri Jan 02, 2015 10:04 pm
by d3vbk » Wed Jun 03, 2015 3:04 am
Finally got ownCloud running on my Pi...and did in under an hour. Did it using the apt-get command :D
http://projpi.com/diy-home-projects-wit ... box-clone/
Posts: 2
Joined: Wed Jun 03, 2015 3:00 am