<s> """<STR_LIT>""" <EOL> from flask import Flask , redirect , url_for , session , request , jsonify <EOL> from flask_oauthlib . client import OAuth <EOL> app = Flask ( __name__ ) <EOL> app . config [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> app . config [ '<STR_LIT>' ] = "<STR_LIT>" <EOL> app . debug = True <EOL> app . secret_key = '<STR_LIT>' <EOL> oauth = OAuth ( app ) <EOL> google = oauth . remote_app ( <EOL> '<STR_LIT>' , <EOL> consumer_key = app . config . get ( '<STR_LIT>' ) , <EOL> consumer_secret = app . config . get ( '<STR_LIT>' ) , <EOL> request_token_params = { <EOL> '<STR_LIT>' : '<STR_LIT:email>' <EOL> } , <EOL> base_url = '<STR_LIT>' , <EOL> request_token_url = None , <EOL> access_token_method = '<STR_LIT:POST>' , <EOL> access_token_url = '<STR_LIT>' , <EOL> authorize_url = '<STR_LIT>' , <EOL> ) <EOL> @ app . route ( '<STR_LIT:/>' ) <EOL> def index ( ) : <EOL> if '<STR_LIT>' in session : <EOL> me = google . get ( '<STR_LIT>' ) <EOL> return jsonify ( { "<STR_LIT:data>" : me . data } ) <EOL> return redirect ( url_for ( '<STR_LIT>' ) ) <EOL> @ app . route ( '<STR_LIT>' ) <EOL> def login ( ) : <EOL> return google . authorize ( callback = url_for ( '<STR_LIT>' , _external = True ) ) <EOL> @ app . route ( '<STR_LIT>' ) <EOL> def logout ( ) : <EOL> session . pop ( '<STR_LIT>' , None ) <EOL> return redirect ( url_for ( '<STR_LIT:index>' ) ) <EOL> @ app . route ( '<STR_LIT>' ) <EOL> def authorized ( ) : <EOL> resp = google . authorized_response ( ) <EOL> if resp is None : <EOL> return '<STR_LIT>' % ( <EOL> request . args [ '<STR_LIT>' ] , <EOL> request . args [ '<STR_LIT>' ] <EOL> ) <EOL> session [ '<STR_LIT>' ] = ( resp [ '<STR_LIT>' ] , '<STR_LIT>' ) <EOL> me = google . get ( '<STR_LIT>' ) <EOL> return jsonify ( { "<STR_LIT:data>" : me . data } ) <EOL> @ google . tokengetter <EOL> def get_google_oauth_token ( ) : <EOL> return session . get ( '<STR_LIT>' ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> app . run ( ) </s>
