diff --git a/src/sessions/twitter/session.py b/src/sessions/twitter/session.py index db7e85af..a219016c 100644 --- a/src/sessions/twitter/session.py +++ b/src/sessions/twitter/session.py @@ -8,6 +8,7 @@ import wx import config import output import application +import appkeys from pubsub import pub import tweepy from tweepy.errors import TweepyException, Forbidden, NotFound @@ -135,9 +136,10 @@ class Session(base.baseSession): if self.settings["twitter"]["user_key"] != None and self.settings["twitter"]["user_secret"] != None: try: log.debug("Logging in to twitter...") - self.auth = tweepy.OAuthHandler(keyring.get("api_key"), keyring.get("api_secret")) + self.auth = tweepy.OAuthHandler(appkeys.twitter_api_key, appkeys.twitter_api_secret) self.auth.set_access_token(self.settings["twitter"]["user_key"], self.settings["twitter"]["user_secret"]) self.twitter = tweepy.API(self.auth) + self.twitter_v2 = tweepy.Client(consumer_key=appkeys.twitter_api_key, consumer_secret=appkeys.twitter_api_secret, access_token=self.settings["twitter"]["user_key"], access_token_secret=self.settings["twitter"]["user_secret"]) if verify_credentials == True: self.credentials = self.twitter.verify_credentials() self.logged = True @@ -156,7 +158,7 @@ class Session(base.baseSession): if self.logged == True: raise Exceptions.AlreadyAuthorisedError("The authorisation process is not needed at this time.") else: - self.auth = tweepy.OAuthHandler(keyring.get("api_key"), keyring.get("api_secret")) + self.auth = tweepy.OAuthHandler(appkeys.twitter_api_key, appkeys.twitter_api_secret) redirect_url = self.auth.get_authorization_url() webbrowser.open_new_tab(redirect_url) self.authorisation_dialog = authorisationDialog() @@ -523,7 +525,7 @@ class Session(base.baseSession): def start_streaming(self): if config.app["app-settings"]["no_streaming"]: return - self.stream = streaming.Stream(twitter_api=self.twitter, user=self.db["user_name"], user_id=self.db["user_id"], muted_users=self.db["muted_users"], consumer_key=keyring.get("api_key"), consumer_secret=keyring.get("api_secret"), access_token=self.settings["twitter"]["user_key"], access_token_secret=self.settings["twitter"]["user_secret"], chunk_size=1025) + self.stream = streaming.Stream(twitter_api=self.twitter, user=self.db["user_name"], user_id=self.db["user_id"], muted_users=self.db["muted_users"], consumer_key=appkeys.twitter_api_key, consumer_secret=appkeys.twitter_api_secret, access_token=self.settings["twitter"]["user_key"], access_token_secret=self.settings["twitter"]["user_secret"], chunk_size=1025) self.stream_thread = call_threaded(self.stream.filter, follow=self.stream.users, stall_warnings=True) def stop_streaming(self): diff --git a/src/write_version_data.py b/src/write_version_data.py index b13675b3..4e123157 100644 --- a/src/write_version_data.py +++ b/src/write_version_data.py @@ -27,3 +27,9 @@ file2 = open("..\\scripts\\twblue.nsi", "w", encoding="utf-8") file2.write(contents) file2.close() print("done") +file3 = open("appkeys.py", "w") +keys = """twitter_api_key = "daMHlXsFlalEWtaqTL7xd6TqZ" +twitter_api_secret = "lOcpsIlhr1lBpA53oNWwmKh9yM6Gqk3IRFOzq9TvAO8B5gisFD" +""" +file3.write(keys) +file3.close() \ No newline at end of file