def back_online_notifier(the_url):
print("found " + the_url + " back online.")
try:
old_status_file = pickle.load(open("status.p", "rb"))
except Exception as ex:
print("The status.p file was not found. it will be recreated." + str(ex))
return
if (the_url in old_status_file) and (old_status_file[the_url]['status'] == "down"):
it_was_down_time = old_status_file[the_url]['time']
current_time = datetime.datetime.now().replace(microsecond=0)
send_message(CHANNEL_ID, ":herb: " + the_url + " is back online. It was down for " + str(current_time - it_was_down_time))
else:
print("skipping notifying that the url is online")
# --- getting only the head ---
评论列表
文章目录