From 06ea95db206617d9d2b5480127894119f91301b1 Mon Sep 17 00:00:00 2001 From: Adar Nimrod <nimrod@shore.co.il> Date: Fri, 13 Aug 2021 22:02:44 +0300 Subject: [PATCH] Log notification errors. Not much I can do about them. --- mnpw/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mnpw/__init__.py b/mnpw/__init__.py index 1119e33..9150be3 100644 --- a/mnpw/__init__.py +++ b/mnpw/__init__.py @@ -15,9 +15,11 @@ HOSTNAME = socket.gethostname() def notify(message): """Send a notification.""" - requests.post( + r = requests.post( # pylint: disable=invalid-name "https://notify.shore.co.il/send", params={"message": message} ) + if not r.ok: + logging.error(f"Failed to send notification: {r.reason}.") def main(): # noqa: MC0001 -- GitLab