def health_check(self, app_name): url = self.APP_URL[app_name] try: health = urllib.request.urlopen(url).read().decode("utf-8") except urllib.error.HTTPError: health = "Service Temporarily Unavailable" if not app_name in health: date = str(datetime.now()) subject = app_name + " health_check" body = app_name + " health check did not finish succesfully at " + date MailUtils.send_mail(subject, body)
def health_check(app_name): url = APP_URL[app_name] print("checking " + app_name + " with " + url) try: health = urllib.request.urlopen(url).read().decode("utf-8") except urllib.error.HTTPError: health = "Service Temporarily Unavailable" print("response: " + health) if not app_name in health: date = str(datetime.now()) MailUtils.send_mail(app_name + " health_check", app_name + " health check did not finish succesfully at " + date) print("\n");