Skip to content

Commit d36c47f

Browse files
committed
修复下载media的bug
1 parent 5a35f41 commit d36c47f

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

wechat/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#encoding=utf-8
2-
VERSION = "0.3.5"
2+
VERSION = "0.3.6"
33

wechat/official.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ def followers(self, next_id=''):
307307
return self._get('user/get', {'next_openid': next_id})
308308

309309
def upload_media(self, mtype, filepath):
310-
# TODO, 对各种类型的文件作合法性校验
311310
path = self.api_entry + 'media/upload?access_token=' \
312311
+ self._access_token + '&type=' + mtype
313312
rsp = requests.post(path, files={'media': open(filepath, 'rb')},
@@ -316,7 +315,9 @@ def upload_media(self, mtype, filepath):
316315

317316
def download_media(self, media_id, to_path):
318317
rsp = requests.get(self.api_entry + 'media/get',
319-
{'media_ia': media_id}, verify=False)
318+
params={'media_id': media_id,
319+
'access_token': self._access_token},
320+
verify=False)
320321
if rsp.status_code == 200:
321322
save_file = open(to_path, 'wb')
322323
save_file.write(rsp.content)

0 commit comments

Comments
 (0)