Skip to content

Commit

Permalink
Update logging and send message content
Browse files Browse the repository at this point in the history
  • Loading branch information
CoolCoderCarl committed Apr 23, 2024
1 parent ca0652a commit 8b2c6be
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,17 @@ def http_requests(hosts: list):
f"Status code: {response.status_code} for this host: {h}"
)
except requests.exceptions.SSLError as ssl_err:
telegram_sender.send_alert_to_telegram(f"{h} and {ssl_err}")
logging.error(f"{ssl_err}")
telegram_sender.send_alert_to_telegram(f"{ssl_err}")
except requests.exceptions.Timeout as timeout_err:
telegram_sender.send_alert_to_telegram(f"{h} and {timeout_err}")
logging.error(f"{timeout_err}")
telegram_sender.send_alert_to_telegram(f"{timeout_err}")
except requests.exceptions.ConnectionError as con_err:
telegram_sender.send_alert_to_telegram(f"{h} and {con_err}")
logging.error(f"{con_err}")
telegram_sender.send_alert_to_telegram(f"{con_err}")
except requests.exceptions.BaseHTTPError as base_http_err:
telegram_sender.send_alert_to_telegram(f"{h} and {base_http_err}")
logging.error(f"{base_http_err}")
telegram_sender.send_alert_to_telegram(f"{base_http_err}")


if __name__ == "__main__":
Expand Down

0 comments on commit 8b2c6be

Please sign in to comment.