TWBlue can run successfully if there are no sessions configured to run at program startup or the Internet connection doesn't work (for example, you are behind a proxy but you haven't configured it yet)

This commit is contained in:
Jose Manuel Delicado 2017-02-13 13:35:32 +01:00
parent b165d564e0
commit 1061967adc
2 changed files with 11 additions and 6 deletions

View File

@ -994,7 +994,8 @@ class Controller(object):
if buffer != None: break
else:
buffer = self.view.search("home_timeline", buf.session.db["user_name"])
self.view.change_buffer(buffer)
if buffer!=None:
self.view.change_buffer(buffer)
def up(self, *args, **kwargs):
page = self.get_current_buffer()

View File

@ -135,11 +135,15 @@ class Session(object):
if the user account isn't authorised, it needs to call self.authorise() before login."""
if self.settings["twitter"]["user_key"] != None and self.settings["twitter"]["user_secret"] != None:
log.debug("Logging in to twitter...")
self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials)
self.logged = True
log.debug("Logged.")
self.counter = 0
try:
log.debug("Logging in to twitter...")
self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials)
self.logged = True
log.debug("Logged.")
self.counter = 0
except:
log.error("The login attempt failed.")
self.logged = False
else:
self.logged = False
raise Exceptions.RequireCredentialsSessionError