diff --git a/mnpw/__init__.py b/mnpw/__init__.py index fbf7a9187019a1d825d458c271569c8c51d8d6a7..51c35545aaa7707223bb2e35c1995a020135b6ef 100644 --- a/mnpw/__init__.py +++ b/mnpw/__init__.py @@ -16,11 +16,16 @@ HOSTNAME = socket.gethostname() def notify(message): """Send a notification.""" - 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}.") + for _ in range(3): + r = requests.post( # pylint: disable=invalid-name + "https://notify.shore.co.il/send", params={"message": message} + ) + if r.ok: + return + logging.warning( + f"Failed to send notification: {r.reason}, will retry." + ) + logging.error("Failed to send notification.") def main(): # noqa: MC0001