简介
本来以前是用同学基于itchar写的,在模型训练完成后向文件传输助手发送消息来告知模型已经训练完毕。现在貌似网页版微信已经不可以使用了,所以将同学的代码重构成基于ServerChan的代码后,分享给大家。
github: https://github.com/PeijiYang/dinglingling
Server Chan
首先需要在server酱官网:http://sc.ftqq.com/3.version注册账号,直接绑定github账号即可,会获得一个SCKEY, 并根据官网教程绑定微信即可。
使用
直接用pip安装dinglingling插件或者使用上文的github链接中的代码根据教程自行安装后即可。
直接在需要监测的函数前加上装饰器wx_reminder即可。使用demo代码如下:
from dinglingling import wx_reminder
SCKEY = "" # the sckey you get from http://sc.ftqq.com/3.version
proxy = "" # if you needn't proxy, ignore it.
# remind_started: if you need remind you when the function
# stated, make remind_started = True
@wx_reminder(SCKEY=SCKEY, proxy=proxy, remind_started=False)
def test_correct_func():
print("hello world")
效果:函数运行完后会朝你的微信发送一条提醒,如图: