python微信库:itchat
来源:互联网 发布:js地图api 定位 编辑:程序博客网 时间:2024/05/07 09:49
因为最近的项目,需要使用微信的接口获取一些数据。
参考:python实现微信接口(itchat)
安装:pip install itchat
常见接口使用:
import itchat
import pandas an pd
1、登录
itchat.login()
itchat.auto_login()
这种方法将会通过微信扫描二维码登录,但是这种登录的方式确实短时间的登录,并不会保留登录的状态,也就是下次登录时还是需要扫描二维码,如果加上hotReload==True,那么就会保留登录的状态,至少在后面的几次登录过程中不会再次扫描二维码,该参数生成一个静态文件itchat.pkl用于存储登录状态
2、获取好友列表
itchat.get_friends(update=True)
3、导出好友列表
df_friends = pd.DataFrame(friends)
df_friends.to_csv(‘friends.csv’, encoding=’utf-8’,index = False)
发送消息
send(msg=”Text Message”, toUserName=None)
参数
msg : 文本消息内容
@fil@path_to_file : 发送文件
@img@path_to_img : 发送图片
@vid@path_to_video : 发送视频
toUserName : 发送对象, 如果留空, 将发送给自己.
返回值
True or False
实例代码
# coding-utf-8import itchatitchat.auto_login()itchat.send("Hello World!")ithcat.send("@fil@%s" % '/tmp/test.text')ithcat.send("@img@%s" % '/tmp/test.png')ithcat.send("@vid@%s" % '/tmp/test.mkv')
- send_msg
itchat.send_msg("hello world.")
- send_file
itchat.send_file("/tmp/test.txt")
-send_image
itchat.send_img("/tmp/test.txt")
- send_video
itchat.send_video("/tmp/test.txt")
- Python微信库: itchat
- python微信库:itchat
- python库之itchat
- python的itchat模块
- python 微信 itchat
- python微信模块 itchat
- itchat
- 微信 聊天 机器人 python itchat
- python itchat实现微信自动回复
- Python学习-Itchat微信API
- python实现微信接口(itchat)
- 用python的itchat库做微信智能回复
- python中利用itchat实现自动回复
- python:使用itchat实现手机控制电脑
- python实现微信接口(itchat)
- 安装python itchat 模块 用python发微信消息
- 使用Python itchat个人微信账号头像拼接
- Python之itchat生成微信头像拼接问题
- bzoj2502 清理雪道
- 低延迟系统的 11 个最佳实践
- 德国图宾根大学发布可扩展「对抗黑盒攻击」,仅通过观察决策即可愚弄深度神经网络
- IPv6-only适配方案
- 购物车适配器
- python微信库:itchat
- 表单验证(三种写法)
- 项目框架搭建 FrameLayout+RadioGroup+TableLayout+ 实现复杂界面布局
- 橘子有多少瓣?
- springboot学习笔记(三)使用JDBC以及整合spring data jpa
- js遍历json中所有的键值对
- [ 1.309420] Freeing initrd memory: 484K 卡死问题解决办法
- 商品订单信息管理
- Qt之创建并使用共享库