From 968c17a357eeb40a1450bb625d129e8d2c67a28d Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 15 Jul 2016 16:29:53 -0500 Subject: [PATCH 1/2] Catch ConnectionResetError when making API request Caught this traceback in the log when an update failed to complete. Also added a generic Exception catch-all. --- i3pystatus/scores/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i3pystatus/scores/__init__.py b/i3pystatus/scores/__init__.py index c4ba7e7..142b8af 100644 --- a/i3pystatus/scores/__init__.py +++ b/i3pystatus/scores/__init__.py @@ -76,7 +76,7 @@ class ScoresBackend(SettingsBase): exc.code, exc.reason, exc.url, ) return {} - except URLError as exc: + except (ConnectionResetError, URLError) as exc: self.logger.critical('Error making request to %s: %s', url, exc) return {} From d0defe0810eea87f286b724623bdc5fa08e0afd3 Mon Sep 17 00:00:00 2001 From: Erik Johnson Date: Fri, 22 Jul 2016 00:15:58 -0500 Subject: [PATCH 2/2] Properly identify rain-shortened games as final These were erroneously being identified as pregame --- i3pystatus/scores/mlb.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/i3pystatus/scores/mlb.py b/i3pystatus/scores/mlb.py index 7109184..54b3740 100644 --- a/i3pystatus/scores/mlb.py +++ b/i3pystatus/scores/mlb.py @@ -269,7 +269,7 @@ class MLB(ScoresBackend): ret['delay'] = game.get('reason', 'Unknown') elif ret['status'] == 'postponed': ret['postponed'] = game.get('reason', 'Unknown Reason') - elif ret['status'] == 'game_over': + elif ret['status'] in ('game_over', 'completed_early'): ret['status'] = 'final' elif ret['status'] not in ('in_progress', 'final'): ret['status'] = 'pregame' @@ -277,7 +277,7 @@ class MLB(ScoresBackend): try: inning = game.get('inning', '0') ret['extra_innings'] = inning \ - if ret['status'] == 'final' and int(inning) > 9 \ + if ret['status'] == 'final' and int(inning) != 9 \ else '' except ValueError: ret['extra_innings'] = ''