@@ -59,7 +59,8 @@ def login(self, enableCmdQR=False, picDir=None, qrCallback=None,
59
59
break
60
60
if isLoggedIn :
61
61
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.' )
63
64
else :
64
65
return # log in process is stopped by user
65
66
logger .info ('Loading the contact, this may take a little while.' )
@@ -129,8 +130,10 @@ def check_login(self, uuid=None):
129
130
regx = r'window.code=(\d+)'
130
131
data = re .search (regx , r .text )
131
132
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'
134
137
elif data :
135
138
return data .group (1 )
136
139
else :
@@ -171,6 +174,11 @@ def process_login_info(core, loginContent):
171
174
core .loginInfo ['wxuin' ] = core .loginInfo ['BaseRequest' ]['Uin' ] = node .childNodes [0 ].data
172
175
elif node .nodeName == 'pass_ticket' :
173
176
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
174
182
175
183
def web_init (self ):
176
184
url = '%s/webwxinit?r=%s' % (self .loginInfo ['url' ], int (time .time ()))
@@ -252,6 +260,8 @@ def maintain_loop():
252
260
self .msgList .put (chatroomMsg )
253
261
update_local_friends (self , otherList )
254
262
retryCount = 0
263
+ except requests .exceptions .ReadTimeout :
264
+ pass
255
265
except :
256
266
retryCount += 1
257
267
logger .error (traceback .format_exc ())
0 commit comments