Skip to content

Commit 6f7d63b

Browse files
committed
Add limited warning
1 parent 86a3fef commit 6f7d63b

File tree

3 files changed

+17
-5
lines changed

3 files changed

+17
-5
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ itchat.run()
5151

5252
这是一个基于这一项目的[开源小机器人][robot-source-code],百闻不如一见,有兴趣可以尝试一下。
5353

54+
由于好友数量实在增长过快,自动通过好友验证的功能演示暂时关闭。
55+
5456
![QRCode][robot-qr]
5557

5658
## 截屏

itchat/components/login.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def login(self, enableCmdQR=False, picDir=None, qrCallback=None,
5959
break
6060
if isLoggedIn:
6161
break
62-
logger.info('Log in time out, reloading QR code.')
62+
elif self.isLogging:
63+
logger.info('Log in time out, reloading QR code.')
6364
else:
6465
return # log in process is stopped by user
6566
logger.info('Loading the contact, this may take a little while.')
@@ -129,8 +130,10 @@ def check_login(self, uuid=None):
129130
regx = r'window.code=(\d+)'
130131
data = re.search(regx, r.text)
131132
if data and data.group(1) == '200':
132-
process_login_info(self, r.text)
133-
return '200'
133+
if process_login_info(self, r.text):
134+
return '200'
135+
else:
136+
return '400'
134137
elif data:
135138
return data.group(1)
136139
else:
@@ -171,6 +174,11 @@ def process_login_info(core, loginContent):
171174
core.loginInfo['wxuin'] = core.loginInfo['BaseRequest']['Uin'] = node.childNodes[0].data
172175
elif node.nodeName == 'pass_ticket':
173176
core.loginInfo['pass_ticket'] = core.loginInfo['BaseRequest']['DeviceID'] = node.childNodes[0].data
177+
if not all([key in core.loginInfo for key in ('skey', 'wxsid', 'wxuin', 'pass_ticket')]):
178+
logger.error('Your wechat account may be LIMITED to log in WEB wechat, error info:\n%s' % r.text)
179+
core.isLogging = False
180+
return False
181+
return True
174182

175183
def web_init(self):
176184
url = '%s/webwxinit?r=%s' % (self.loginInfo['url'], int(time.time()))
@@ -252,6 +260,8 @@ def maintain_loop():
252260
self.msgList.put(chatroomMsg)
253261
update_local_friends(self, otherList)
254262
retryCount = 0
263+
except requests.exceptions.ReadTimeout:
264+
pass
255265
except:
256266
retryCount += 1
257267
logger.error(traceback.format_exc())

itchat/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os, platform
22

3-
VERSION = '1.3.7'
3+
VERSION = '1.3.8'
44
BASE_URL = 'https://login.weixin.qq.com'
5-
OS = platform.system() #Windows, Linux, Darwin
5+
OS = platform.system() # Windows, Linux, Darwin
66
DIR = os.getcwd()
77
DEFAULT_QR = 'QR.png'
88
TIMEOUT = (10, 60)

0 commit comments

Comments
 (0)