PushBear试用 - 喝水提醒小助手
PushBear简介
基于微信模板的一对多消息送达服务
接入说明
详见官网 http://pushbear.ftqq.com
DEMO
废话不多说,直接贴代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| import requests import datetime from apscheduler.schedulers.blocking import BlockingScheduler
global times times = 1
def remind(): global times sendkey = '此处换成自己的' text = '提醒喝水小助手' desp = '这是今天第' + str(times) + '次提醒你喝水啦' payload = {'sendkey': sendkey, 'text': text, 'desp': desp} requests.post("https://pushbear.ftqq.com/sub", data=payload) times = times + 1 now_hour = datetime.datetime.now().hour if now_hour >= 21: times = 1
if __name__ == "__main__": sched = BlockingScheduler() sched.add_job(remind, 'cron', hour='10,11,14,15,16,17,18,21', minute=6) sched.start()
|