diff --git a/matrix_webhook/formatters/pingdom.py b/matrix_webhook/formatters/pingdom.py index 8179be3..a5d6dfa 100644 --- a/matrix_webhook/formatters/pingdom.py +++ b/matrix_webhook/formatters/pingdom.py @@ -4,12 +4,14 @@ from datetime import datetime def formatter(data, headers): """Pretty-print a pingdom notification.""" # JSON data formatting was obtained from https://www.pingdom.com/resources/webhooks/ + # these are common to all check types check_id = data["check_id"] check_name = data["check_name"] current_state = data["current_state"] local_time = datetime.fromtimestamp(data["state_changed_timestamp"]) if data["check_type"].lower() == "http": + # http https or http_custom check types try: check_url = data["check_params"]["full_url"] data["body"] = ( @@ -18,13 +20,11 @@ def formatter(data, headers): f"[view details](https://my.pingdom.com/reports/responsetime#check={check_id})" ) except Exception as error: - data[ - "body" - ] = ( - f"Error: An attempt to post from pingdom was malformed " - "(or I don't know how to handle what was sent).\n\n" - f"{repr(error)}" - ) + data["body"] = ( + f"Error: An attempt to post from pingdom was malformed " + "(or I don't know how to handle what was sent).\n\n" + f"{repr(error)}" + ) elif data["check_type"].lower() == "dns": # There are a bunch of values that are blanke when you do a test # so ignore them if value is unset