mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-22 11:18:08 -06:00
Two fixes for the last commit
This commit is contained in:
parent
462f6fe395
commit
007da773c9
@ -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"):
|
||||
|
@ -9,9 +9,10 @@ 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)
|
||||
self.credentials = self.twitter.verify_credentials()
|
||||
if verify_credentials == True:
|
||||
self.credentials = self.twitter.verify_credentials()
|
||||
|
||||
def authorise(self, settings):
|
||||
authorisationHandler.logged = False
|
||||
|
Loading…
Reference in New Issue
Block a user