from __future__ import unicode_literals
from threading import Timer
from wxpy import *
import requests
bot = None
def get_news():
# 获取一个连接中的内容
url = "http://open.iciba.com/dsapi/"
r = requests.get(url)
print(r.json())
contents = r.json()['content']
translation = r.json()['translation']
return contents, translation
def login_wechat():
global bot
bot = Bot()
def send_news():
# if bot == None:
# login_wechat()
try:
bot = Bot(console_qr=2, cache_path=True)
groups = bot.groups(update=True)
print(groups)
my_friend = bot.groups(update=True).search(u"数据分析部")[0]
my_friend.send(u"大家好,我是杨鑫的机器人!!, 我即将被安装在Centos服务器上")
t = Timer(360, send_news) # 360是
Python实现微信机器人
最新推荐文章于 2025-07-13 18:44:53 发布
