diff --git a/nearquake/tweet_processor.py b/nearquake/tweet_processor.py index 2d8119a..39e1447 100644 --- a/nearquake/tweet_processor.py +++ b/nearquake/tweet_processor.py @@ -29,6 +29,9 @@ def _tweepy_connect(self) -> tweepy.client: self.client = client + def __init__(self) -> None: + self._tweepy_connect() + def post_tweet(self, tweet_text: dict) -> None: """ Post a tweet to twitter @@ -61,5 +64,6 @@ def run_tweet_operator(self, tweet_text: dict, conn) -> None: :param tweet_text: A dictionary containing the tweet data to be posted and saved. :param conn: A database connection object used to insert the tweet data into the database. """ + self._tweepy_connect() self.post_tweet(tweet_text=tweet_text) self.save_tweet_to_db(tweet_text=tweet_text, conn=conn)