From bd693f6f42a11b38c23d82731486b5fb53107c2e Mon Sep 17 00:00:00 2001 From: "A.M. Rowsell" Date: Wed, 5 Feb 2025 23:27:49 -0500 Subject: [PATCH] Added check for non-existant lastupdate key --- .gitignore | 3 ++- discorss.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index f8ec04c..d48e085 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ *.conf *.txt -log/ \ No newline at end of file +log/ +*.bak \ No newline at end of file diff --git a/discorss.py b/discorss.py index bd1f182..b869e7c 100755 --- a/discorss.py +++ b/discorss.py @@ -59,7 +59,10 @@ def main(): with open(config_file_path, "r") as config_file: app_config = json.load(config_file) now = time.mktime(time.localtime()) - last_check = app_config["lastupdate"] + try: + last_check = app_config["lastupdate"] + except KeyError: + last_check = now - 21600 # first run, no lastupdate, check up to 6 hours ago for i, hook in enumerate(app_config["feeds"]): # Get the feed feed = feedparser.parse(hook["url"])