Added check for non-existant lastupdate key
This commit is contained in:
parent
8683d08d1c
commit
bd693f6f42
2 changed files with 6 additions and 2 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
*.conf
|
*.conf
|
||||||
*.txt
|
*.txt
|
||||||
log/
|
log/
|
||||||
|
*.bak
|
|
@ -59,7 +59,10 @@ def main():
|
||||||
with open(config_file_path, "r") as config_file:
|
with open(config_file_path, "r") as config_file:
|
||||||
app_config = json.load(config_file)
|
app_config = json.load(config_file)
|
||||||
now = time.mktime(time.localtime())
|
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"]):
|
for i, hook in enumerate(app_config["feeds"]):
|
||||||
# Get the feed
|
# Get the feed
|
||||||
feed = feedparser.parse(hook["url"])
|
feed = feedparser.parse(hook["url"])
|
||||||
|
|
Loading…
Add table
Reference in a new issue