Browse Source

change sync url

liuwons 8 years ago
parent
commit
962e789cc5
2 changed files with 6 additions and 4 deletions
  1. 4 2
      test.py
  2. 2 2
      wxbot.py

+ 4 - 2
test.py

@@ -10,10 +10,12 @@ class MyWXBot(WXBot):
             self.send_msg_by_uid(u'hi', msg['user']['id'])
             self.send_img_msg_by_uid("img/1.png", msg['user']['id'])
             self.send_file_msg_by_uid("img/1.png", msg['user']['id'])
-'''
+
     def schedule(self):
         self.send_msg(u'测试群', u'测试')
-'''
+        self.send_img_msg_by_uid("img/1.png", self.get_user_id(u"测试群"))
+        self.send_file_msg_by_uid("img/1.png", self.get_user_id(u"测试群"))
+        time.sleep(5)
 
 
 def main():

+ 2 - 2
wxbot.py

@@ -1227,7 +1227,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':
@@ -1244,7 +1244,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'