Merge pull request #412 from terminalmage/scores
Catch ConnectionResetError when making API request
This commit is contained in:
commit
2603a394cd
@ -76,7 +76,7 @@ class ScoresBackend(SettingsBase):
|
|||||||
exc.code, exc.reason, exc.url,
|
exc.code, exc.reason, exc.url,
|
||||||
)
|
)
|
||||||
return {}
|
return {}
|
||||||
except URLError as exc:
|
except (ConnectionResetError, URLError) as exc:
|
||||||
self.logger.critical('Error making request to %s: %s', url, exc)
|
self.logger.critical('Error making request to %s: %s', url, exc)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ class MLB(ScoresBackend):
|
|||||||
ret['delay'] = game.get('reason', 'Unknown')
|
ret['delay'] = game.get('reason', 'Unknown')
|
||||||
elif ret['status'] == 'postponed':
|
elif ret['status'] == 'postponed':
|
||||||
ret['postponed'] = game.get('reason', 'Unknown Reason')
|
ret['postponed'] = game.get('reason', 'Unknown Reason')
|
||||||
elif ret['status'] == 'game_over':
|
elif ret['status'] in ('game_over', 'completed_early'):
|
||||||
ret['status'] = 'final'
|
ret['status'] = 'final'
|
||||||
elif ret['status'] not in ('in_progress', 'final'):
|
elif ret['status'] not in ('in_progress', 'final'):
|
||||||
ret['status'] = 'pregame'
|
ret['status'] = 'pregame'
|
||||||
@ -277,7 +277,7 @@ class MLB(ScoresBackend):
|
|||||||
try:
|
try:
|
||||||
inning = game.get('inning', '0')
|
inning = game.get('inning', '0')
|
||||||
ret['extra_innings'] = inning \
|
ret['extra_innings'] = inning \
|
||||||
if ret['status'] == 'final' and int(inning) > 9 \
|
if ret['status'] == 'final' and int(inning) != 9 \
|
||||||
else ''
|
else ''
|
||||||
except ValueError:
|
except ValueError:
|
||||||
ret['extra_innings'] = ''
|
ret['extra_innings'] = ''
|
||||||
|
Loading…
Reference in New Issue
Block a user