From ccd0c60d874a97c0f0d0a092c8412c38e33967b7 Mon Sep 17 00:00:00 2001 From: Callum Leslie Date: Sat, 4 Jun 2022 00:31:56 +0100 Subject: [PATCH] Add default values for environment variables This should reduce errors by some values not being set in the .env file - namely 2FA and Theme --- main.py | 2 +- reddit/subreddit.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/main.py b/main.py index 8cc3c9a..57256df 100644 --- a/main.py +++ b/main.py @@ -20,7 +20,7 @@ reddit_object = get_subreddit_threads() load_dotenv() length, number_of_comments = save_text_to_mp3(reddit_object) -download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME")) +download_screenshots_of_reddit_posts(reddit_object, number_of_comments, os.getenv("THEME", "light")) download_background() chop_background_video(length) final_video = make_final_video(number_of_comments) diff --git a/reddit/subreddit.py b/reddit/subreddit.py index 5d020fe..c7714ce 100644 --- a/reddit/subreddit.py +++ b/reddit/subreddit.py @@ -15,7 +15,7 @@ def get_subreddit_threads(): print_step("Getting AskReddit threads...") - if os.getenv("REDDIT_2FA").lower() == "yes": + if os.getenv("REDDIT_2FA", default="no").lower() == "yes": print( "\nEnter your two-factor authentication code from your authenticator app.\n" )