Browse Source

Merge pull request #86 from xjoker/master-dev

fix upload_media can't send img problem
Weston Liu 8 years ago
parent
commit
5dbbe3f8c5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      wxbot.py

+ 2 - 2
wxbot.py

@@ -953,7 +953,7 @@ class WXBot:
         if not os.path.exists(fpath):
             print '[ERROR] File not exists.'
             return None
-        url = 'https://file.wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json'
+        url = 'https://file2.wx.qq.com/cgi-bin/mmwebwx-bin/webwxuploadmedia?f=json'
         flen = str(os.path.getsize(fpath))
         ftype = mimetypes.guess_type(fpath)[0] or 'application/octet-stream'
         files = {
@@ -973,7 +973,7 @@ class WXBot:
                     })),
                 'webwx_data_ticket': (None, self.session.cookies['webwx_data_ticket']),
                 'pass_ticket': (None, self.pass_ticket),
-                'filename': (os.path.basename(fpath), ftype, open(fpath, 'rb')),
+                'filename': (os.path.basename(fpath), open(fpath, 'rb'),ftype.split('/')[1]),
                 }
         self.file_index += 1
         try: