update_msg.py 634 B

123456789101112131415161718192021222324252627282930
  1. """
  2. @author: luojunhui
  3. """
  4. import time
  5. from config import accountBaseInfo
  6. from tqdm import tqdm
  7. from tasks.task4 import update_articles
  8. import schedule
  9. def run():
  10. gh_id_set = set()
  11. for key in accountBaseInfo:
  12. value = accountBaseInfo[key]['ghId']
  13. gh_id_set.add(value)
  14. for gh_id in tqdm(gh_id_set):
  15. try:
  16. update_articles(gh_id)
  17. except Exception as e:
  18. print(e)
  19. continue
  20. if __name__ == '__main__':
  21. schedule.every().day.at("21:00").do(run)
  22. while True:
  23. schedule.run_pending()
  24. print("定时任务正在执行")
  25. time.sleep(1)