Skip to content

Commit 417ab9c

Browse files
authored
Expiration bug fix (dropbox#195)
* Fix expires_in vs expiration parameter name bug * Remove examples from comments, fix expires_in/expiration naming mismatch
1 parent 13ec3ac commit 417ab9c

File tree

1 file changed

+3
-53
lines changed

1 file changed

+3
-53
lines changed

dropbox/oauth.py

Lines changed: 3 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def __init__(self, access_token, account_id, user_id, url_state, refresh_token,
103103
account_id=account_id,
104104
user_id=user_id,
105105
refresh_token=refresh_token,
106-
expires_in=expires_in,
106+
expiration=expires_in,
107107
scope=scope)
108108
self.url_state = url_state
109109

@@ -280,25 +280,8 @@ class DropboxOAuth2FlowNoRedirect(DropboxOAuth2FlowBase):
280280
OAuth 2 authorization helper for apps that can't provide a redirect URI
281281
(such as the command-line example apps).
282282
283-
Example::
283+
See examples under example/oauth
284284
285-
from dropbox import DropboxOAuth2FlowNoRedirect
286-
287-
auth_flow = DropboxOAuth2FlowNoRedirect(APP_KEY, APP_SECRET)
288-
289-
authorize_url = auth_flow.start()
290-
print("1. Go to: " + authorize_url)
291-
print("2. Click \\"Allow\\" (you might have to log in first).")
292-
print("3. Copy the authorization code.")
293-
auth_code = raw_input("Enter the authorization code here: ").strip()
294-
295-
try:
296-
oauth_result = auth_flow.finish(auth_code)
297-
except Exception as e:
298-
print('Error: %s' % (e,))
299-
return
300-
301-
dbx = Dropbox(oauth_result.access_token)
302285
"""
303286

304287
def __init__(self, consumer_key, consumer_secret=None, locale=None, token_access_type='legacy',
@@ -375,40 +358,7 @@ class DropboxOAuth2Flow(DropboxOAuth2FlowBase):
375358
user authorize your app. The second involves getting an OAuth 2 access
376359
token from Dropbox.
377360
378-
Example::
379-
380-
from dropbox import DropboxOAuth2Flow
381-
382-
def get_dropbox_auth_flow(web_app_session):
383-
redirect_uri = "https://my-web-server.org/dropbox-auth-finish"
384-
return DropboxOAuth2Flow(
385-
APP_KEY, APP_SECRET, redirect_uri, web_app_session,
386-
"dropbox-auth-csrf-token")
387-
388-
# URL handler for /dropbox-auth-start
389-
def dropbox_auth_start(web_app_session, request):
390-
authorize_url = get_dropbox_auth_flow(web_app_session).start()
391-
redirect_to(authorize_url)
392-
393-
# URL handler for /dropbox-auth-finish
394-
def dropbox_auth_finish(web_app_session, request):
395-
try:
396-
oauth_result = \\
397-
get_dropbox_auth_flow(web_app_session).finish(
398-
request.query_params)
399-
except BadRequestException, e:
400-
http_status(400)
401-
except BadStateException, e:
402-
# Start the auth flow again.
403-
redirect_to("/dropbox-auth-start")
404-
except CsrfException, e:
405-
http_status(403)
406-
except NotApprovedException, e:
407-
flash('Not approved? Why not?')
408-
return redirect_to("/home")
409-
except ProviderException, e:
410-
logger.log("Auth error: %s" % (e,))
411-
http_status(403)
361+
See examples under example/oauth
412362
413363
"""
414364

0 commit comments

Comments
 (0)