@app.route('/oauth2callback')
def oauth2callback():
flow = client.flow_from_clientsecrets(
'client_secrets.json',
scope='https://www.googleapis.com/auth/drive.metadata.readonly',
redirect_uri=flask.url_for('oauth2callback', _external=True),
include_granted_scopes=True)
if 'code' not in flask.request.args:
auth_uri = flow.step1_get_authorize_url()
return flask.redirect(auth_uri)
else:
auth_code = flask.request.args.get('code')
credentials = flow.step2_exchange(auth_code)
flask.session['credentials'] = credential.to_json()
return flask.redirect(flask.url_for('home'))
, который при вызове дает следующее исключение
ERROR 2016-04-19 11:10:59,804 wsgi.py:279]
Traceback (most recent call last):
File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/google/appengine/runtime/wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1836, in __call__
return self.wsgi_app(environ, start_response)
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1820, in wsgi_app
response = self.make_response(self.handle_exception(e))
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1403, in handle_exception
reraise(exc_type, exc_value, tb)
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1817, in wsgi_app
response = self.full_dispatch_request()
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1477, in full_dispatch_request
rv = self.handle_user_exception(e)
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1381, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1475, in full_dispatch_request
rv = self.dispatch_request()
File "/Users/vinay/App-Engine/Rainbow/gaenv/flask/app.py", line 1461, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/Users/vinay/App-Engine/Rainbow/mainsite/__init__.py", line 65, in oauth2callback
include_granted_scopes=True)
File "/Users/vinay/App-Engine/Rainbow/gaenv/oauth2client/util.py", line 135, in positional_wrapper
return wrapped(*args, **kwargs)
TypeError: flow_from_clientsecrets() got an unexpected keyword argument 'include_granted_scopes'
INFO 2016-04-19 11:10:59,881 module.py:787] default: "GET /oauth2callback HTTP/1.1" 500 -