利用pyserverchan推送程序输出
背景介绍
在深度学习的过程中,训练时间一般很长,如果可以将训练结果自动推送到微信上,可以省去不少的麻烦。Server酱是一个向微信发送自定义信息的服务,我将该服务打包成了pyserverchan,可以让python用户简单的调用。
注册Server酱
进入Server酱官网,只需要两个步骤即可完成注册。
- 在主页登陆GitHub账号,获得一个SCKEY
- 点击微信推送,进行绑定
至此,你已经获得了一个SCKEY。在python中这样设置你的user_URL
user_URL = 'https://sc.ftqq.com/' + SCKEY + '.send'
使用pyserverchan
安装pyserverchan
pip install pyserverchan
在Python中发送文字,图片(png格式),Markdown格式文件。(至多64K)
from pyserverchan import pyserver
svc = pyserver.ServerChan(user_URL)
svc.output_to_weixin("ATestMessage.")
svc.output_to_weixin_picture("http://sc.ftqq.com/static/image/bottom_logo.png")
svc.output_to_weixin_markdown("J:/p