Two fixes for the last commit

This commit is contained in:
Manuel Cortez 2015-03-08 00:36:41 -06:00
parent 462f6fe395
commit 007da773c9
2 changed files with 6 additions and 5 deletions

View File

@ -117,14 +117,14 @@ class Session(object):
self.sound = sound.soundSystem(self.settings["sound"])
@_require_configuration
def login(self):
def login(self, verify_credentials=True):
""" Login in to twitter using credentials from settings.
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"])
self.twitter.login(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"], verify_credentials)
self.logged = True
log.debug("Logged.")
else:
@ -325,7 +325,7 @@ class Session(object):
del self.twitter
self.logged = False
self.twitter = twitter.twitter.twitter()
self.login()
self.login(False)
if self.reconnection_function_active == True: return
self.reconnection_function_active = True
if not hasattr(self, "main_stream"):

View File

@ -9,8 +9,9 @@ import authorisationHandler
class twitter(object):
def login(self, user_key, user_secret):
def login(self, user_key, user_secret, verify_credentials):
self.twitter = Twython(keyring.get("api_key"), keyring.get("api_secret"), user_key, user_secret)
if verify_credentials == True:
self.credentials = self.twitter.verify_credentials()
def authorise(self, settings):