From 189ffcc1a8ce58feef72db1befe6a763ab1c289d Mon Sep 17 00:00:00 2001 From: Lili Date: Mon, 13 Mar 2023 14:59:20 +0100 Subject: [PATCH] add error check to is_stream_live() --- tlapbot/owncast_helpers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tlapbot/owncast_helpers.py b/tlapbot/owncast_helpers.py index 3b91544..28a7666 100644 --- a/tlapbot/owncast_helpers.py +++ b/tlapbot/owncast_helpers.py @@ -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"]