don't do except all -.- rather repair the fcking logging.

This commit is contained in:
b3yond 2018-04-14 17:31:01 +02:00
parent bf7c21c113
commit 4d556ec595

View file

@ -101,21 +101,18 @@ def login_twitter(user):
Starts the twitter OAuth authentication process. Starts the twitter OAuth authentication process.
:return: redirect to twitter. :return: redirect to twitter.
""" """
consumer_key = config["twitter"]["consumer_key"]
consumer_secret = config["twitter"]["consumer_secret"]
callback_url = url("login/twitter/callback")
auth = tweepy.OAuthHandler(consumer_key, consumer_secret, callback_url)
try: try:
consumer_key = config["twitter"]["consumer_key"] redirect_url = auth.get_authorization_url()
consumer_secret = config["twitter"]["consumer_secret"] except tweepy.TweepError:
callback_url = url("login/twitter/callback") logger.error('Twitter OAuth Error: Failed to get request token.',
auth = tweepy.OAuthHandler(consumer_key, consumer_secret, callback_url) exc_info=True)
try: return dict(error="Failed to get request token.")
redirect_url = auth.get_authorization_url() user.save_request_token(auth.request_token)
except tweepy.TweepError: return bottle.redirect(redirect_url)
logger.error('Twitter OAuth Error: Failed to get request token.',
exc_info=True)
return dict(error="Failed to get request token.")
user.save_request_token(auth.request_token)
return bottle.redirect(redirect_url)
except Exception:
logger.error("Error with Sign in with Twitter.", exc_info= True)
@get('/login/twitter/callback') @get('/login/twitter/callback')
@ -174,3 +171,5 @@ bottle.install(SessionPlugin('/'))
if __name__ == '__main__': if __name__ == '__main__':
# testing only # testing only
bottle.run(host='localhost', port=8080) bottle.run(host='localhost', port=8080)
else:
application.catchall = False