From 3ecc90d21a9a601e64a5c94cc2268eeff47f4090 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Tue, 26 Apr 2016 22:17:33 -0700 Subject: [PATCH] Add request status to notifier logs --- data/interfaces/default/notification_config.html | 2 +- plexpy/notifiers.py | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/data/interfaces/default/notification_config.html b/data/interfaces/default/notification_config.html index d1dd0675..f352fda6 100644 --- a/data/interfaces/default/notification_config.html +++ b/data/interfaces/default/notification_config.html @@ -74,7 +74,7 @@ from plexpy import helpers

Test ${agent['name']}

-

Test if ${agent['name']} notifications are working. See logs for troubleshooting.

+

Test if ${agent['name']} notifications are working. See logs for troubleshooting.

% if agent['name'] == 'Scripts':
diff --git a/plexpy/notifiers.py b/plexpy/notifiers.py index 95421229..c8edb0c1 100644 --- a/plexpy/notifiers.py +++ b/plexpy/notifiers.py @@ -637,7 +637,7 @@ class PROWL(object): logger.info(u"PlexPy Notifiers :: Prowl notification sent.") return True elif request_status == 401: - logger.warn(u"PlexPy Notifiers :: Prowl notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: Prowl notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: Prowl notification failed.") @@ -943,7 +943,7 @@ class PUSHBULLET(object): logger.info(u"PlexPy Notifiers :: PushBullet notification sent.") return True elif request_status >= 400 and request_status < 500: - logger.warn(u"PlexPy Notifiers :: PushBullet notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: PushBullet notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: PushBullet notification failed.") @@ -1045,7 +1045,7 @@ class PUSHALOT(object): logger.info(u"PlexPy Notifiers :: Pushalot notification sent.") return True elif request_status == 410: - logger.warn(u"PlexPy Notifiers :: Pushalot notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: Pushalot notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: Pushalot notification failed.") @@ -1104,7 +1104,7 @@ class PUSHOVER(object): logger.info(u"PlexPy Notifiers :: Pushover notification sent.") return True elif request_status >= 400 and request_status < 500: - logger.warn(u"PlexPy Notifiers :: Pushover notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: Pushover notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: Pushover notification failed.") @@ -1630,7 +1630,7 @@ class IFTTT(object): logger.info(u"PlexPy Notifiers :: Ifttt notification sent.") return True elif request_status >= 400 and request_status < 500: - logger.warn(u"PlexPy Notifiers :: Ifttt notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: Ifttt notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: Ifttt notification failed.") @@ -1699,7 +1699,7 @@ class TELEGRAM(object): logger.info(u"PlexPy Notifiers :: Telegram notification sent.") return True elif request_status >= 400 and request_status < 500: - logger.warn(u"PlexPy Notifiers :: Telegram notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: Telegram notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: Telegram notification failed.") @@ -1792,7 +1792,7 @@ class SLACK(object): logger.info(u"PlexPy Notifiers :: Slack notification sent.") return True elif request_status >= 400 and request_status < 500: - logger.warn(u"PlexPy Notifiers :: Slack notification failed: %s" % response.reason) + logger.warn(u"PlexPy Notifiers :: Slack notification failed: [%s] %s" % (request_status, response.reason)) return False else: logger.warn(u"PlexPy Notifiers :: Slack notification failed.")