There is something wrong with the example code in the dropbox documentation
from dropbox import DropboxOAuth2FlowNoRedirect
auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY, APP_SECRET)
authorize_url = auth_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."
auth_code = raw_input("Enter the authorization code here: ").strip()
try:
access_token, user_id = auth_flow.finish(auth_code)
except Exception, e:
print('Error: %s' % (e,))
return
dbx = Dropbox(access_token)
The source is http://dropbox-sdk-python.readthedocs.io/en/master/moduledoc.html#module-dropbox.oauth
There is something wrong with the try/exception part. After that, it says
NameError: name 'access_token' is not defined