Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log in time out, reloading QR code. 二维码一直刷新,手机来不及登录 #8

Closed
jamesocy opened this issue Dec 20, 2022 · 49 comments

Comments

@jamesocy
Copy link

无限Log in time out, reloading QR code.
无论切换网络环境还是切换账号,手速再快都会超时。

@zhayujie
Copy link
Owner

zhayujie commented Dec 20, 2022

itchat的一个已知问题,参考 littlecodersh/ItChat#970why2lyj/ItChat-UOS#14

临时方案可以在 itchat/components/login.py 的 login() 函数中,在进入 while not isLoggedIn 循环前增加一个time.sleep(15)

image

如何找到 itchat 源码并修改?

1.先找到安装路径

pip3 show itchat-uos

输出的Location字段就是安装路径, 在我的ubuntu服务器上该值是 /usr/local/lib/python3.7/site-packages
image

源码的完整路径为:/usr/local/lib/python3.7/site-packages/itchat/components/login.py

注意:pip3 必须属于 用来启动程序的python,否则修改无效。有多版本python的环境需要注意这一点。

2. 修改代码

修改login.py 中的 login函数,在 while not isLoggedIn 循环前加上一个sleep(15), 代码在第59行。

@jamesocy

This comment was marked as outdated.

@zhayujie

This comment was marked as outdated.

@DY0203

This comment was marked as outdated.

@WTdeWT
Copy link

WTdeWT commented Feb 6, 2023

image

请问这个二维码通过微信扫不出来有什么好办法解决吗

@AdvancingStone
Copy link

二维码手机扫码确认后,就出现 Log in time out, reloading QR code.
Getting uuid of QR code.
Downloading QR code.

无限Log in time out, reloading QR code. 无论切换网络环境还是切换账号,手速再快都会超时。
这个要如何解决呢,一直是这样的

@heyanfeng
Copy link

image
二维码中间有一些乱码,扫描没反应咋整

@fountainhead-gq
Copy link

image

请问这个二维码通过微信扫不出来有什么好办法解决吗

@heyanfeng 你这个解决了么,咋搞的

@niezhenchao
Copy link

登录之后,给微信发信息并没有回复啊

@zhayujie zhayujie changed the title Log in time out Log in time out, reloading QR code. 二维码一直刷新,手机来不及登录 Feb 7, 2023
@zhayujie zhayujie pinned this issue Feb 7, 2023
@wzsqcmap
Copy link

wzsqcmap commented Feb 8, 2023

在命令行的二维码出现乱码时,可以要程序根目录里找到QR.png文件,直接打开扫码即可

@skywalkeryin
Copy link

skywalkeryin commented Feb 9, 2023

我写了一个自动修改itchat/components/login.py的bash 脚本

#!/bin/bash

# Define the file name and the line number
pack_dir="$(pip3 show itchat-uos | grep "Location" | awk '{print $2}')"
file_name="${pack_dir}/itchat/components/login.py"
line_number=59

# Define the line of code to be inserted
code="time.sleep(15)"
line_of_code="\ \ \ \ \ \ \ \ $code"

# Use the sed command to insert the line
sed -i "${line_number}i ${line_of_code}" "${file_name}"

# Define the start and end line numbers
start_line=50
end_line=70

# Use the sed command to print the desired lines
sed -n "${start_line},${end_line}p" "${file_name}"

@ghost
Copy link

ghost commented Feb 9, 2023

手速只要快,二维码不是事

@blackzhangwei
Copy link

大佬这个我换了个远程端shh窗口就好了

@songwj521dmly
Copy link

生成的二维码是空格和'\u2005'拼接的,总体是个长方形,比例不对

@ziji1224054593
Copy link

安装 itchat-uos 后

@fungaren
Copy link

LOCATION=$(pip3 show itchat-uos | grep Location | cut -d ' ' -f 2)
sed -i '/isLoggedIn = False/ a\        time.sleep(15)' $LOCATION/itchat/components/login.py
sed -i '/isLoggedIn = False/ a\        asyncio.sleep(15)' $LOCATION/itchat/async_components/login.py
sed -i '/if isLoggedIn:/ i\            time.sleep(1)' $LOCATION/itchat/components/login.py
sed -i '/if isLoggedIn:/ i\            asyncio.sleep(1)' $LOCATION/itchat/async_components/login.py

littlecodersh/ItChat#971

@Unique-work
Copy link


image
屏幕截图 2023-03-03 224630

@linikkor
Copy link

linikkor commented Mar 5, 2023

Please scan the QR code to log in.
Please press confirm on your phone.
[ERROR][2023-03-05 10:33:51][app.py:19] - App startup failed!
[ERROR][2023-03-05 10:33:51][app.py:20] - mismatched tag: line 64, column 4
Traceback (most recent call last):
File "app.py", line 17, in
channel.startup()
File "/root/chatgpt-on-wechat/channel/wechat/wechat_channel.py", line 37, in startup
itchat.auto_login(enableCmdQR=2)
File "/usr/local/lib/python3.8/dist-packages/itchat/components/register.py", line 35, in auto_login
self.login(enableCmdQR=enableCmdQR, picDir=picDir, qrCallback=qrCallback,
File "/usr/local/lib/python3.8/dist-packages/itchat/components/login.py", line 53, in login
status = self.check_login()
File "/usr/local/lib/python3.8/dist-packages/itchat/components/login.py", line 137, in check_login
if process_login_info(self, r.text):
File "/usr/local/lib/python3.8/dist-packages/itchat/components/login.py", line 172, in process_login_info
for node in xml.dom.minidom.parseString(r.text).documentElement.childNodes:
File "/usr/lib/python3.8/xml/dom/minidom.py", line 1969, in parseString
return expatbuilder.parseString(string)
File "/usr/lib/python3.8/xml/dom/expatbuilder.py", line 925, in parseString
return builder.parseString(string)
File "/usr/lib/python3.8/xml/dom/expatbuilder.py", line 223, in parseString
parser.Parse(string, True)
xml.parsers.expat.ExpatError: mismatched tag: line 64, column 4

@hal0n0sec
Copy link

image
各位遇到过吗

@jarrettleen
Copy link

image 各位遇到过吗

同问,我也是

@MarZaKore
Copy link

登录之后,给微信发信息并没有回复啊

微信没有返回,有解决吗

@JohnGeng-xj
Copy link

改了第59行代码,正常运行了几天。但是今天突然不行,第59行代码改了,还是timeout,怎么解决啊?

@LiWeiQiangAndroid
Copy link

风控了吗

@ZHENGAWU666
Copy link

image
微信可以登录上去,当时一直只回复我连接不到你的网络,我用的是阿里云服务器,ip填了,端口那里没填,请问这样是什么问题

@ZHENGAWU666
Copy link

image

@wjfkook
Copy link

wjfkook commented May 6, 2023

docker部署的如何找到login.py修改?

在docker file 中执行我写的bash脚本

容器中执行报错了:
WARNING: Package(s) not found: itchat-uos
sed: can't read /itchat/components/login.py: No such file or directory
sed: can't read /itchat/components/login.py: No such file or directory

@Qsrass
Copy link

Qsrass commented Aug 13, 2023

docker部署的如何找到login.py修改?

在docker file 中执行我写的bash脚本

容器中执行报错了: WARNING: Package(s) not found: itchat-uos sed: can't read /itchat/components/login.py: No such file or directory sed: can't read /itchat/components/login.py: No such file or directory

应该是Bash权限问题,我也遇到了

@Qsrass
Copy link

Qsrass commented Aug 13, 2023

群晖docker 修改login.py 的已知方案是在 SSH中打开 /volume1/@docker/btrfs/subvolumes 目录,使用 du -h –max-depth=0 * 查询目录下所有的文件及大小,查询输出信息找到对应的文件目录,进去修改login.py 。如果你进入的目录下没有login.py 或者打开是空文件则目录错误,继续寻找。
如何确认成功修改?直接在ssh中进入容器,使用bash vi /usr/local/lib/python3.7/site-packages/itchat/components/login.py 查看内部信息。
建议按照FunTeng的建议修改:
#回复:修改login.py 中的 login函数,在 while not isLoggedIn 循环前加上一个sleep(15), 代码在第59行。
添加这个会报错。个人的做法是搜索login.py文件中两处time.sleep(1),把它们都改成time.sleep(5),问题解决。

@1352608667
Copy link

image

请问这个二维码通过微信扫不出来有什么好办法解决吗
同级目录下有个qr的图片直接扫就行

@Qsrass
Copy link

Qsrass commented Aug 31, 2023 via email

@XJPeng12
Copy link

itchat的一个已知问题,参考 littlecodersh/ItChat#970why2lyj/ItChat-UOS#14

临时方案可以在 itchat/components/login.py 的 login() 函数中,在进入 while not isLoggedIn 循环前增加一个time.sleep(15)

image

如何找到 itchat 源码并修改?

1.先找到安装路径

pip3 show itchat-uos

输出的Location字段就是安装路径, 在我的ubuntu服务器上该值是 /usr/local/lib/python3.7/site-packages image

源码的完整路径为:/usr/local/lib/python3.7/site-packages/itchat/components/login.py

注意:pip3 必须属于 用来启动程序的python,否则修改无效。有多版本python的环境需要注意这一点。

2. 修改代码

修改login.py 中的 login函数,在 while not isLoggedIn 循环前加上一个sleep(15), 代码在第59行。

修改后报错:

Getting uuid of QR code.
Downloading QR code.
Please scan the QR code to log in.
Traceback (most recent call last):
File "D:\pycode\test_code\itchat\test.py", line 10, in
itchat.auto_login()
File "D:\Software\miniconda3\envs\itchat\lib\site-packages\itchat\components\register.py", line 35, in auto_login
self.login(enableCmdQR=enableCmdQR, picDir=picDir, qrCallback=qrCallback,
File "D:\Software\miniconda3\envs\itchat\lib\site-packages\itchat\components\login.py", line 56, in login
status = self.check_login()
File "D:\Software\miniconda3\envs\itchat\lib\site-packages\itchat\components\login.py", line 142, in check_login
if process_login_info(self, r.text):
File "D:\Software\miniconda3\envs\itchat\lib\site-packages\itchat\components\login.py", line 184, in process_login_info
core.loginInfo['wxsid'] = core.loginInfo['BaseRequest']['Sid'] = cookies["wxsid"]
KeyError: 'wxsid'

我是在windows10的pycharm中测试的代码
import itchat

itchat.auto_login()

itchat.send('Hello, filehelper', toUserName='filehelper')

请问这个错误应该怎么解决啊?

rhinewg pushed a commit to rhinewg/chatgpt-on-wechat that referenced this issue Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests