From b73a5a5d86af1b900d84f583ef2a51a87057f42d Mon Sep 17 00:00:00 2001 From: Kris Knigga Date: Tue, 7 Nov 2023 13:38:15 -0600 Subject: [PATCH] Fix #34: Sometimes Alaska never exits Civil Twilight --- loggingnight.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/loggingnight.py b/loggingnight.py index 625b354..8aade00 100755 --- a/loggingnight.py +++ b/loggingnight.py @@ -218,10 +218,14 @@ def lookup(self): (i["phen"], i["time"]) for i in self.usno["response"]["properties"]["data"]["sundata"] ) - sun_rise = dateparser.parse(phenTimes["Rise"]) - sun_set = dateparser.parse(phenTimes["Set"]) - start_civil_twilight = dateparser.parse(phenTimes["Begin Civil Twilight"]) - end_civil_twilight = dateparser.parse(phenTimes["End Civil Twilight"]) + sun_rise = dateparser.parse(phenTimes.get("Rise", "00:00")) + sun_set = dateparser.parse(phenTimes.get("Set", "23:59")) + start_civil_twilight = dateparser.parse( + phenTimes.get("Begin Civil Twilight", "00:00") + ) + end_civil_twilight = dateparser.parse( + phenTimes.get("End Civil Twilight", "23:59") + ) return { "sun_rise": sun_rise,