Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
mehtez
9 years agoNew member | Level 2
I get a NameError when I use the noredirect code out of the documentation for python.
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
1 Reply
- Greg-DB9 years ago
Dropbox Community Moderator
[Cross-linking for reference: https://stackoverflow.com/questions/41040463/is-this-code-in-the-dropbox-documentation-right ]
Thanks for the report! That sample is out of date. We'll get that fixed up.
It looks like someone was kind enough to share an updated version in your StackOveflow post already.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!