但凡一件事,稍微有些重复。我就考虑怎么样用程序来实现它。这里给各位程序员朋友分享如何每天给朋友定时微信发送”晚安“,故事,新闻,等等··· ···最好运行在服务器上,这样后台挂起来更方便。准备:微信号
pip install wxpy
pip install requests代码:# 不要抄下源码就运行,你需要改动几个地方from __future__ import unicode_literalsfrom threading import Timerfrom wxpy import *import requestsbot = Bot()# linux执行登陆请调用下面的这句#bot = Bot(console_qr=2,cache_path="botoo.pkl")def get_news(): """获取金山词霸每日一句,英文和翻译""" url = "http://open.iciba.com/dsapi/" r = requests.get(url) content = r.json()['content'] note = r.json()['note'] return content, notedef send_news(): try: contents = get_news()
………………………………