diff --git a/foodie_weekly_thread.py b/foodie_weekly_thread.py index 1c36f3e..004456b 100644 --- a/foodie_weekly_thread.py +++ b/foodie_weekly_thread.py @@ -99,7 +99,7 @@ except Exception as e: def generate_intro_tweet(author): """Generate an intro tweet for the weekly thread.""" - credentials = next((cred for cred in X_API_CREDENTIALS if cred["username"] == author["username"]), None) + credentials = X_API_CREDENTIALS.get(author["username"]) if not credentials: logging.error(f"No X credentials found for {author['username']}") return None @@ -145,7 +145,7 @@ def generate_intro_tweet(author): def generate_final_cta(author): """Generate a final CTA tweet for the weekly thread using GPT.""" - credentials = next((cred for cred in X_API_CREDENTIALS if cred["username"] == author["username"]), None) + credentials = X_API_CREDENTIALS.get(author["username"]) if not credentials: logging.error(f"No X credentials found for {author['username']}") return None