@@ -103,7 +103,7 @@ def __init__(self, access_token, account_id, user_id, url_state, refresh_token,
103
103
account_id = account_id ,
104
104
user_id = user_id ,
105
105
refresh_token = refresh_token ,
106
- expires_in = expires_in ,
106
+ expiration = expires_in ,
107
107
scope = scope )
108
108
self .url_state = url_state
109
109
@@ -280,25 +280,8 @@ class DropboxOAuth2FlowNoRedirect(DropboxOAuth2FlowBase):
280
280
OAuth 2 authorization helper for apps that can't provide a redirect URI
281
281
(such as the command-line example apps).
282
282
283
- Example::
283
+ See examples under example/oauth
284
284
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)
302
285
"""
303
286
304
287
def __init__ (self , consumer_key , consumer_secret = None , locale = None , token_access_type = 'legacy' ,
@@ -375,40 +358,7 @@ class DropboxOAuth2Flow(DropboxOAuth2FlowBase):
375
358
user authorize your app. The second involves getting an OAuth 2 access
376
359
token from Dropbox.
377
360
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
412
362
413
363
"""
414
364
0 commit comments