add error check to is_stream_live()
This commit is contained in:
parent
0d56521602
commit
189ffcc1a8
|
@ -6,7 +6,11 @@ from re import sub
|
||||||
# # # requests stuff # # #
|
# # # requests stuff # # #
|
||||||
def is_stream_live():
|
def is_stream_live():
|
||||||
url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/status'
|
url = current_app.config['OWNCAST_INSTANCE_URL'] + '/api/status'
|
||||||
|
try:
|
||||||
r = requests.get(url)
|
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"]
|
return r.json()["online"]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue