Get app key and secret here. Save them to a file called dropbox.txt.

In [1]:
with open("dropbox.txt") as f:
    app_key,app_secret = f.readlines()
app_key,app_secret = app_key.strip(),app_secret.strip()

Following this tutorial.

In [2]:
import dropbox
In [3]:
flow = dropbox.client.DropboxOAuth2FlowNoRedirect(app_key, app_secret)
In [9]:
authorize_url = flow.start()
print '1. Go to: ' + authorize_url
print '2. Click "Allow" (you might have to log in first)'
print '3. Copy the authorization code.'
1. Go to: https://www.dropbox.com/1/oauth2/authorize?response_type=code&client_id=hvgd9nm3q2o6pmr
2. Click "Allow" (you might have to log in first)
3. Copy the authorization code.
In [11]:
code = raw_input("Enter the authorization code here: ").strip()
Enter the authorization code here: 76ZCZZZQ_pYAAAAAAAAAAX1oMc2vEawMRylNvHIKpww
In [12]:
access_token, user_id = flow.finish(code)
In [35]:
client = dropbox.client.DropboxClient(access_token)
print 'linked account: ', client.account_info()['display_name']
linked account:  yoav ram
In [36]:
fname = "github-wolverine.jpg"
f, metadata = client.get_file_and_metadata('/' + fname)
out = open(fname, 'wb')
out.write(f.read())
out.close()
print metadata['size']
93.4 KB
In [34]:
from IPython.core.display import Image 
Image(filename=fname) 
Out[34]: