必须首先安装wechat_sender。
pip安装微信发送器
pip安装wxpy
信息技术图表
请求
创建并写入send_msg.py文件。
fromwxpyimport * fromwechat _ sender导入* bot=bot (console _ QR=1,cache _ path=false (name=' breakout ' my=)
然后,要运行python send_msg.py,必须在此时使用微信扫描代码登录微信页面版。
剩下的是你要发送的信息。 名为wechat_sender的可以访问日志。 但是这想让我每天自动给她发信息。 我们可以这样做。
from we chat _ sender导入发送器,listenimportrequestsimportdatetimeimportrandomdefsendenglish (: headers={ ' user-) ) x64 ) appleWebKit/537.36(khtml,like Gecko ) chrome/32.0.1667.0 safari/537.36 (response=requests.get ) ) headers=headers (数据=response.JSON ) voice=data('TTS ' ) English=data('content ' ) Chinese=data ) ) ) 一起学习英语吧^_^ n音频地址:{} n图像:{}n'.format(English,chinese,voice, picture ) returnresnow=datetime.datetime.now now.minutename=' sender ' #要发送的人if hour==8and minute 20: RES=send end 然后,将crontab设置为计时器任务。 例如:
这里使用的是虚拟环境。 可以根据你的python路径和send_english进行保管。
*/20 * * *1-5/home/wenjia/. local/share/virtuale NVS/wechatsend-og MBR 6v7/zrdc/python/home/wenjia/wwww
其实说白了很简单。 就是制作新的文件。 然后填写计算任务。 执行结束后,或者有修改的地方就删除。 然后,只需由crontab执行。 1 .添加: echo '1* * */home/test '/user/crontab file2.删除: sed-I '/test/d '/user/crontab file 3如果你以前是crontab -e 你创建新文件是在重写之前!
然后自动添加提醒并显示提醒列表。
更多使用案例: https://微信发送器. readthedocs.io/zh _ cn/latest /