临沂网站公众号建设,网站上怎么做艳丽的色,高清装饰画图片素材网,wordpress ssh但凡一件事#xff0c;稍微有些重复#xff0c;我就考虑怎么样用程序来实现它。这里给各位程序员朋友分享如何每天给朋友定时微信发送”晚安“#xff0c;故事#xff0c;新闻等等。最好运行在服务器上#xff0c;这样后台挂起来更方便。准备#xff1a;**微信号**
pip i… 但凡一件事稍微有些重复我就考虑怎么样用程序来实现它。这里给各位程序员朋友分享如何每天给朋友定时微信发送”晚安“故事新闻等等。最好运行在服务器上这样后台挂起来更方便。准备 **微信号**
pip install **wxpy**
pip install **requests**代码如下# 不要抄下源码就运行你需要改动几个地方from __future__ import unicode_literals
from threading import Timerfrom wxpy import *
import requestsbot Bot() # linux执行登陆请调用下面的这句#bot Bot(console_qr2,cache_pathbotoo.pkl)def get_news(): 获取金山词霸每日一句英文和翻译url http://open.iciba.com/dsapi/r requests.get(url)content r.json()[content]note r.json()[note]return content, note def send_news(): try:contents get_news() # 你朋友的微信名称不是备注也不是微信帐号。my_friend bot.friends().search(u小明)[0]my_friend.send(contents[0])my_friend.send(contents[1])my_friend.send(uHave a good one!) # 每86400秒1天发送1次t Timer(86400, send_news)t.start()except:# 你的微信名称不是微信帐号。my_friend bot.friends().search(常念)[0]my_friend.send(u今天消息发送失败了)if __name__ __main__:send_news()最终效果是这样的总结代码让生活更美好作者botoo来源http://www.cnblogs.com/botoo/p/8622379.html版权归原作者所有转载仅供学习使用不用于任何商业用途如有侵权请留言联系删除感谢合作。数据与算法之美用数据解决不可能长按扫码关注