From 507d8aa7d23a3e37acd2a9b37dec0d0f88f50625 Mon Sep 17 00:00:00 2001 From: AdeHub Date: Sun, 8 Sep 2019 17:27:51 +1200 Subject: [PATCH] Telegram --- headphones/notifiers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/headphones/notifiers.py b/headphones/notifiers.py index ac9c1bd6..5f3e8620 100644 --- a/headphones/notifiers.py +++ b/headphones/notifiers.py @@ -1038,6 +1038,7 @@ class TELEGRAM(object): 'release-group/%s">MusicBrainz' % rgid # Send image + response = None if image: image_file = {'photo': (image, open(image, "rb"))} payload = {'chat_id': userid, 'parse_mode': "HTML", 'caption': status + message} @@ -1055,7 +1056,7 @@ class TELEGRAM(object): # Error logging sent_successfuly = True - if not response.status_code == 200: + if response and not response.status_code == 200: logger.info("Could not send notification to TelegramBot (token=%s). Response: [%s]", token, response.text) sent_successfuly = False