uptimemonitor.py 文件源码

python
阅读 27 收藏 0 点赞 0 评论 0

项目:SlackUptimeMonitor 作者: AndreiD 项目源码 文件源码
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 ---
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号