diff --git a/main.py b/main.py index 7342159..4633630 100644 --- a/main.py +++ b/main.py @@ -99,7 +99,7 @@ post_type="fact", message=message, ) - post_to_all_platforms(tweet_text=tweet_text.get("post")) + post_to_all_platforms(text=tweet_text.get("post")) save_tweet_to_db(tweet_text, conn) if args.weekly: @@ -124,7 +124,7 @@ post_type="fact", message=message, ) - post_to_all_platforms(tweet_text=tweet_text.get("post")) + post_to_all_platforms(text=tweet_text.get("post")) save_tweet_to_db(tweet_text, conn) if args.monthly: @@ -149,7 +149,7 @@ post_type="fact", message=message, ) - post_to_all_platforms(tweet_text=tweet_text.get("post")) + post_to_all_platforms(text=tweet_text.get("post")) save_tweet_to_db(tweet_text, conn) if args.initialize: @@ -161,7 +161,7 @@ tweet_text = format_earthquake_alert(post_type="fact", message=message) - post_to_all_platforms(tweet_text=tweet_text.get("post")) + post_to_all_platforms(text=tweet_text.get("post")) save_tweet_to_db(tweet_text, conn) if args.backfill: diff --git a/nearquake/data_processor.py b/nearquake/data_processor.py index 2883b32..ffab148 100644 --- a/nearquake/data_processor.py +++ b/nearquake/data_processor.py @@ -16,7 +16,7 @@ generate_coordinate_lookup_detail_url, generate_time_range_url, ) -from nearquake.post_manager import post_to_all_platforms +from nearquake.post_manager import post_to_all_platforms, save_tweet_to_db from nearquake.utils import ( convert_timestamp_to_utc, fetch_json_data_from_url, @@ -319,7 +319,8 @@ def upload(self): ) try: - post_to_all_platforms(post_text=tweet_text) + post_to_all_platforms(text=tweet_text.get("post")) + save_tweet_to_db(tweet_text, self.conn) except Exception as e: _logger.error( diff --git a/nearquake/post_manager.py b/nearquake/post_manager.py index 9f45f3a..9dec0ec 100644 --- a/nearquake/post_manager.py +++ b/nearquake/post_manager.py @@ -70,7 +70,7 @@ def save_tweet_to_db(tweet_text: dict, conn) -> bool: return False -def post_to_all_platforms(post_text: str) -> dict: +def post_to_all_platforms(text: str) -> dict: platforms = [TwitterPost(), BlueSkyPost()] for platform in platforms: - platform.post(post_text) + platform.post(text)