13

9行Python代码调用个人微信API创建一个微信机器人(Wechaty开源iPad协议)

 3 years ago
source link: https://segmentfault.com/a/1190000040617850
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

什么是WeChaty?

WeChaty是Github的一个开源个人微信API项目,提供了Python、PHP、NodeJs等程序,便于我们使用API操作个人微信:https://github.com/wechaty/we...

目前WeChaty有多种渠道实现

image.png

在这之前,有著名的itChat和wxpy让我们调用网页版微信接口实现操作微信,现在网页版微信基本不可以登录了,所以开发者就开发了WeChaty,WeChaty是一款现代会话式RPA SDK,适用于聊天机器人的开发,只需几行代码即可创建一个微信机器人。

如何使用WeChaty?

本文介绍使用Python使用WeChaty登录你的个人微信。官方的源码是使用iPad协议实现的,源码下载:https://github.com/wechaty/py...

# 第一步,下载源码
# 第二步,cd到源码的目录
cd python-wechaty-getting-started

# 第三步,安装
pip install -r requirements.txt

# 第四步,配置服务和TOKEN
Linux和Mac Os命令
export WECHATY_PUPPET=wechaty-puppet-service
export WECHATY_PUPPET_SERVICE_TOKEN=你申请的TOKEN

Windows命令
set WECHATY_PUPPET=wechaty-puppet-service
set WECHATY_PUPPET_SERVICE_TOKEN=你申请的TOKEN

# 第五步,启动微信机器人
cd到examples目录
cd examples

执行ding-dong-bot.py
python ding-dong-bot.py

TOKEN申请

image.png

申请地址:http://175.27.139.176

对于以上问题,可咨询微信找我研究:sansure2016(本文在多个平台发布,加我记得备注你在哪个平台加的)


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK