企业微信机器人自动提醒

前提条件:
1、一台不会关机的电脑
2、python运行环境,安装需要的包
3、运行下面的python代码,注意需要把里面的内容改成你想要的。
企业微信机器人自动提醒_第1张图片

from datetime import datetime
from chinese_calendar import is_workday
import copy
import json
import time
import requests
import schedule
def daka():
    api_path = "创建一个企业微信机器人,用那个网址替换这里"
    headers = {'Content-Type': 'application/json'}
    data1={
        "msgtype":"markdown",
        "markdown":{
            "content":"# 记得打卡"
        }
    }
    # date = datetime(2021, 10, 8)
    date = datetime.now().date()
    if (is_workday(date)):
        a = requests.post(api_path, data=json.dumps(data1), headers=headers)
        print(a.content)
        print("xxxxxxxxx企业微信机器人,请勿关闭xxxxxxxxx")
     
# run_();
daka();
if __name__ == '__main__':
    print('-----------启动定时任务,请勿关闭该窗体---------------')
    schedule.every().day.at("08:55").do(daka)
    schedule.every().day.at("18:30").do(daka)
    while True:
        schedule.run_pending()

你可能感兴趣的:(工具使用,企业微信)