def createUser(self, content): try: user = User(content["name"], content["email"], DB.encrypt(content["pin"])) except KeyError as e: raise BadRequest("I/O error: {0} was not included".format(e)) try: user.clockwidget(content["clockwidget"]) except KeyError as e: print("I/O error: {0} was not included".format(e)) try: user.twitterwidget(content["twittertoken"]) except KeyError as e: print("I/O error: {0} was not included".format(e)) try: user.calendarwidget(content["calendarwidget"]) except KeyError as e: print("I/O error: {0} was not included".format(e)) try: user.mapswidget(content["mapswidget"]) except KeyError as e: print("I/O error: {0} was not included".format(e)) try: user.weatherwidget(content["weatherwidget"]) except KeyError as e: print("I/O error: {0} was not included".format(e)) return user
google = oauth.remote_app( 'google', consumer_key=os.environ.get('GOOGLE_ID'), consumer_secret=os.environ.get('GOOGLE_SECRET'), request_token_params={ 'scope': 'https://www.googleapis.com/auth/calendar.readonly email profile https://www.googleapis.com/auth/gmail.readonly' }, base_url='https://www.googleapis.com/oauth2/v1/', request_token_url=None, access_token_method='POST', access_token_url='https://accounts.google.com/o/oauth2/token', authorize_url='https://accounts.google.com/o/oauth2/auth', ) currentUser = User("", "", "") @app.route('/') def index(): return render_template('index.html') @app.route('/login') def login(): return google.authorize(callback=url_for('authorized', _external=True), prompt='consent') @app.route('/logout') def logout():