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
  • 相关阅读:
    CLSCompliantAttribute
    杂言
    批处理修改目录的隐藏属性
    unittest基本用法
    unittest跳过用例
    MySQL流程控制结构
    MySQL视图
    MySQL函数
    unittest断言 & 数据驱动
    PLSQL
  • 原文地址:https://www.cnblogs.com/cupleo/p/15411834.html
Copyright © 2011-2022 走看看