Skip to content

Instantly share code, notes, and snippets.

@nad2000
Forked from anonymous/gist:5705535
Last active December 18, 2015 01:39
Show Gist options
  • Save nad2000/5705543 to your computer and use it in GitHub Desktop.
Save nad2000/5705543 to your computer and use it in GitHub Desktop.
# Include the Dropbox SDK libraries
from dropbox import client, rest, session
# Get your app key and secret from the Dropbox developer website
APP_KEY = 'KEYKEYKEY'
APP_SECRET = 'SECRET'
# ACCESS_TYPE should be 'dropbox' or 'app_folder' as configured for your app
ACCESS_TYPE = 'dropbox' ### 'app_folder'
sess = session.DropboxSession(APP_KEY, APP_SECRET, ACCESS_TYPE)
request_token = sess.obtain_request_token()
url = sess.build_authorize_url(request_token)
# Make the user sign in and authorize this token
print "url:", url
print "Please visit this website and press the 'Allow' button, then hit 'Enter' here."
raw_input()
# This will fail if the user didn't visit the above URL
access_token = sess.obtain_access_token(request_token)
#Print the token for future reference
print access_token
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment