python-微信

2022/7/12 1:32:53

本文主要是介绍python-微信,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

 

wxpy/itchat已禁用

自从微信禁止网页版登陆之后,itchat 库实现的功能也就都不能用了; itchat现在叫wxpy

1.安装库wxpy:

PS D:\01VSCodeScript\Python> pip install -U wxpy
Collecting wxpy
  Downloading wxpy-0.3.9.8.tar.gz (45 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.7/45.7 kB 283.9 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting itchat==1.2.32
  Downloading itchat-1.2.32-py2.py3-none-any.whl (34 kB)
Requirement already satisfied: requests in c:\users\12593\appdata\roaming\python\python310\site-packages (from wxpy) (2.28.1)
Collecting future
  Downloading future-0.18.2.tar.gz (829 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 829.2/829.2 kB 7.3 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting pypng
  Downloading pypng-0.0.21-py3-none-any.whl (48 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.1/48.1 kB 14.4 kB/s eta 0:00:00
Collecting pyqrcode
  Downloading PyQRCode-1.2.1.zip (41 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 41.9/41.9 kB 17.6 kB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Requirement already satisfied: idna<4,>=2.5 in c:\users\12593\appdata\roaming\python\python310\site-packages (from requests->wxpy) (3.3)
Requirement already satisfied: charset-normalizer<3,>=2 in c:\users\12593\appdata\roaming\python\python310\site-packages (from requests->wxpy) (2.1.0)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\12593\appdata\roaming\python\python310\site-packages (from requests->wxpy) (2022.6.15)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\12593\appdata\roaming\python\python310\site-packages (from requests->wxpy) (1.26.10)
Using legacy 'setup.py install' for wxpy, since package 'wheel' is not installed.
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Using legacy 'setup.py install' for pyqrcode, since package 'wheel' is not installed.
Installing collected packages: pyqrcode, pypng, future, itchat, wxpy
  Running setup.py install for pyqrcode ... done
  Running setup.py install for future ... done
  Running setup.py install for wxpy ... done
Successfully installed future-0.18.2 itchat-1.2.32 pypng-0.0.21 pyqrcode-1.2.1 wxpy-0.3.9.8
PS D:\01VSCodeScript\Python> 

2、测试脚本:

from wxpy import *

#初始化机器人,扫码登录
bot=Bot()
# 给即日起自己发送消息
bot.self.send('hello word!')
# 给文件传输助手发送消息
bot.file_helper.send('hello word!')

3、运行报错:

 

 

发生异常: ExpatError  mismatched tag: line 63, column 4

查到原因是:https://wx.qq.com/  ,微信官网已经禁用使用微信网页版登录了;

 



这篇关于python-微信的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程