add error check to is_stream_live()

This commit is contained in:
Lili (Tlapka) 2023-03-13 14:59:20 +01:00
parent 0d56521602
commit 189ffcc1a8
1 changed files with 5 additions and 1 deletions

View File

@ -6,7 +6,11 @@ from re import sub
# # # requests stuff # # #
def is_stream_live():
url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/status'
r = requests.get(url)
try:
r = requests.get(url)
except requests.exceptions.RequestException as e:
current_app.logger.error(f"Error occured checking if stream is live: {e.args[0]}")
return False
return r.json()["online"]