Skip to content

Commit

Permalink
Add limited warning
Browse files Browse the repository at this point in the history
  • Loading branch information
littlecodersh committed Jun 27, 2017
1 parent 86a3fef commit 6f7d63b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ itchat.run()

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

由于好友数量实在增长过快,自动通过好友验证的功能演示暂时关闭。

![QRCode][robot-qr]

## 截屏
Expand Down
16 changes: 13 additions & 3 deletions itchat/components/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ def login(self, enableCmdQR=False, picDir=None, qrCallback=None,
break
if isLoggedIn:
break
logger.info('Log in time out, reloading QR code.')
elif self.isLogging:
logger.info('Log in time out, reloading QR code.')
else:
return # log in process is stopped by user
logger.info('Loading the contact, this may take a little while.')
Expand Down Expand Up @@ -129,8 +130,10 @@ def check_login(self, uuid=None):
regx = r'window.code=(\d+)'
data = re.search(regx, r.text)
if data and data.group(1) == '200':
process_login_info(self, r.text)
return '200'
if process_login_info(self, r.text):
return '200'
else:
return '400'
elif data:
return data.group(1)
else:
Expand Down Expand Up @@ -171,6 +174,11 @@ def process_login_info(core, loginContent):
core.loginInfo['wxuin'] = core.loginInfo['BaseRequest']['Uin'] = node.childNodes[0].data
elif node.nodeName == 'pass_ticket':
core.loginInfo['pass_ticket'] = core.loginInfo['BaseRequest']['DeviceID'] = node.childNodes[0].data
if not all([key in core.loginInfo for key in ('skey', 'wxsid', 'wxuin', 'pass_ticket')]):
logger.error('Your wechat account may be LIMITED to log in WEB wechat, error info:\n%s' % r.text)
core.isLogging = False
return False
return True

def web_init(self):
url = '%s/webwxinit?r=%s' % (self.loginInfo['url'], int(time.time()))
Expand Down Expand Up @@ -252,6 +260,8 @@ def maintain_loop():
self.msgList.put(chatroomMsg)
update_local_friends(self, otherList)
retryCount = 0
except requests.exceptions.ReadTimeout:
pass
except:
retryCount += 1
logger.error(traceback.format_exc())
Expand Down
4 changes: 2 additions & 2 deletions itchat/config.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import os, platform

VERSION = '1.3.7'
VERSION = '1.3.8'
BASE_URL = 'https://login.weixin.qq.com'
OS = platform.system() #Windows, Linux, Darwin
OS = platform.system() # Windows, Linux, Darwin
DIR = os.getcwd()
DEFAULT_QR = 'QR.png'
TIMEOUT = (10, 60)
Expand Down

0 comments on commit 6f7d63b

Please sign in to comment.