Skip to content

Commit

Permalink
Avoid failure in login of accounts with big contact & make qrcode bigger
Browse files Browse the repository at this point in the history
  • Loading branch information
littlecodersh committed Feb 17, 2017
1 parent ff35f6f commit d42f0f4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions itchat/components/contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,11 @@ def get_contact(self, update=False):
headers = {
'ContentType': 'application/json; charset=UTF-8',
'User-Agent' : config.USER_AGENT, }
r = self.s.get(url, headers=headers)
try:
r = self.s.get(url, headers=headers)
except:
logger.info('Failed to fetch contact, that may because of the amount of your chatrooms')
return []
tempList = json.loads(r.content.decode('utf-8', 'replace'))['MemberList']
chatroomList, otherList = [], []
for m in tempList:
Expand Down Expand Up @@ -350,7 +354,8 @@ def get_head_img(self, userName=None, chatroomUserName=None, picDir=None):
'''
params = {
'userName': userName or chatroomUserName or self.storageClass.userName,
'skey': self.loginInfo['skey'], }
'skey': self.loginInfo['skey'],
'type': 'big', }
url = '%s/webwxgeticon' % self.loginInfo['url']
if chatroomUserName is None:
infoDict = self.storageClass.search_friends(userName=userName)
Expand Down
2 changes: 1 addition & 1 deletion itchat/components/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def get_QR(self, uuid=None, enableCmdQR=False, picDir=None, qrCallback=None):
picDir = picDir or config.DEFAULT_QR
qrStorage = io.BytesIO()
qrCode = QRCode('https://login.weixin.qq.com/l/' + uuid)
qrCode.png(qrStorage)
qrCode.png(qrStorage, scale=10)
if hasattr(qrCallback, '__call__'):
qrCallback(uuid=uuid, status='0', qrcode=qrStorage.getvalue())
else:
Expand Down
2 changes: 1 addition & 1 deletion itchat/config.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import os, platform

VERSION = '1.2.24'
VERSION = '1.2.25'
BASE_URL = 'https://login.weixin.qq.com'
OS = platform.system() #Windows, Linux, Darwin
DIR = os.getcwd()
Expand Down

0 comments on commit d42f0f4

Please sign in to comment.