Browse Source

修复1102,0和-1,-1的问题

test_sync_check函数完善,将4个服务器地址均放进去检测,得到合适的心跳服务器地址
vivre 8 years ago
parent
commit
7db6de7b9e
1 changed files with 2 additions and 2 deletions
  1. 2 2
      wxbot.py

+ 2 - 2
wxbot.py

@@ -1116,7 +1116,7 @@ class WXBot:
         return dic['BaseResponse']['Ret'] == 0
 
     def test_sync_check(self):
-        for host in ['webpush', 'webpush2']:
+        for host in ['webpush.wx', 'webpush2.wx','webpush.weixin', 'webpush2.weixin2',]:
             self.sync_host = host
             retcode = self.sync_check()[0]
             if retcode == '0':
@@ -1133,7 +1133,7 @@ class WXBot:
             'synckey': self.sync_key_str,
             '_': int(time.time()),
         }
-        url = 'https://' + self.sync_host + '.wx.qq.com/cgi-bin/mmwebwx-bin/synccheck?' + urllib.urlencode(params)
+        url = 'https://' + self.sync_host + '.qq.com/cgi-bin/mmwebwx-bin/synccheck?' + urllib.urlencode(params)
         try:
             r = self.session.get(url, timeout=60)
             r.encoding = 'utf-8'