itchat模块简介
itchat是一个通过基于python3,封装了登录网页版微信并收发消息相关的接口,使用python中的itchat模块,可以快速获取好友信息等。
给手机助手发送消息
import itchat #第三方模块 需要网络下载
import time
itchat.auto_login() ##自动登录,会生成二维码
while True:
##给微信的手机助手发信息
chat.send(‘hello’,toUserName=‘filehelper’)
itchat.send_file(’/etc/passwd’,toUserName=‘filehelper’)
time.sleep(1)
该程序运行之后,会出现二维码进行扫描登录
安卓系统的手机无法进行操作,苹果系统应该可以
以下为安卓手机扫码后显示的报错
import itchat
itchat.auto_login(hotReload=True,enableCmdQR=True
##hotReload是自动重连,无需多次扫码,为可选项;