代码拉取完成,页面将自动刷新
from mirrorlib import find_out_of_date_mirrors
from config import MIRRORS
from notification import (
update_twitter_status, send_warning_email,
send_status_email)
def __tweet_outofdate(mirror, last_update):
""" Send a tweet saying we have a mirror out of date """
status = "{0} is out of date, it was last updated {1}".format(mirror,
last_update)
update_twitter_status(status)
def daily_out_of_date_mirror_check():
""" run everything """
results = find_out_of_date_mirrors(mirrors=MIRRORS)
if results:
email_message = ""
for res in results:
email_message += "{0} was last updated {1}\n".format(
res.get('mirror'),
res.get('time_diff_human'))
print("{0} is out of date. {1}".format(
res.get('mirror'), res.get('time_diff_human')))
# one tweet for each out of date mirror
__tweet_outofdate(res.get('mirror'), res.get('time_diff_human'))
# one email for all out of date mirrors
send_warning_email(email_message)
else:
print("All is good, sending Good message!")
send_status_email("[All Mirrors are up to date]")
def run():
""" run all of the daily cron jobs."""
daily_out_of_date_mirror_check()
if __name__ == '__main__':
run()
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。