1. Make sure you install the dropbox module first of course,

opkg update
opkg install python-openssl #adds ssl support to python
opkg install distribute #it contains the easy_install 
easy_install dropbox

2. Create an app under your own dropbox account in the "App Console". (https://www.dropbox.com/developers/apps)

3. Just for the record I created my App with the following:

  1. App Type as "Dropbox API APP".
  2. Type of data access as "Files & Datastores"
  3. Folder access as "My app needs access to files already on Dropbox". (ie: Permission Type as "Full Dropbox".)

4. Then click the "generate access token" button and cut/paste into the python example below in place of :

http://stackoverflow.com/questions/23894221/upload-file-to-my-dropbox-from-python-script

nano /mnt/sda1/uploaddropbox.py
#!/usr/bin/python
import dropbox
#client = dropbox.client.DropboxClient(<auth_token>)
client = dropbox.client.DropboxClient("P9wJXJRuXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX9hmHMlLUQbWI")
print 'linked account: ', client.account_info()
f = open('/mnt/sda1/test.wav', 'rb')
response = client.put_file('/test.wav', f)
print 'uploaded: ', response
chmod 755 /mnt/sda1/uploaddropbox.py
/mnt/sda1/uploaddropbox.py

Comments powered by CComment