zoukankan      html  css  js  c++  java
  • python 定时任务发送

    from apscheduler.schedulers.blocking import BlockingScheduler
    from datetime import datetime,timedelta,date
    import requests
    import os
    
    def check_related_phone():
        lastday_count = """
          ****
        """
        total = conn_alg.search(lastday_count)
        alg_pids = int(total[0]['total']) if len(total) > 0 else 0
        if alg_pids == 0:
            data = {
                  "msgtype": "markdown",
                  "markdown": {
                     "content": """@所有人,<font color="info">中文
    快中文</font>""",
                     }
                  }
            r = requests.post(url, headers=headers, json=data) 
    
    
    url = "https://*******************"
    headers = {"Content-Type": "text/plain"} 
    
    scheduler = BlockingScheduler()
    scheduler.add_job(check_zjk_project_id, 'cron', day_of_week='0-4',hour='*/2')
    scheduler.add_job(check_related_phone, 'cron', hour=10, minute=0)
    print('Press Ctrl+{0} to exit'.format('Break' if os.name == 'nt' else 'C'))
    try:
        scheduler.start()
    except (KeyboardInterrupt, SystemExit):
        pass
  • 相关阅读:
    PAT 1142 Maximal Clique
    PAT 1076 Forwards on Weibo
    PAT 1021 Deepest Root
    PAT 1030 Travel Plan*
    diji模板
    PAT 1020 Tree Traversals
    PAT 1108 Finding Average
    PAT 1104 Sum of Number Segments
    PAT 1100 Mars Numbers
    PAT 1096 Consecutive Factors
  • 原文地址:https://www.cnblogs.com/cupleo/p/15411834.html
Copyright © 2011-2022 走看看