diff --git a/woa/media.py b/woa/media.py index 209a21a..f9679ef 100644 --- a/woa/media.py +++ b/woa/media.py @@ -116,12 +116,12 @@ class WeChatMediaManager: async with aiohttp.ClientSession(timeout=timeout) as session: async with session.post(url, data=form) as resp: - result = await resp.json() - - if resp.status == 200 and ('media_id' in result or 'url' in result): + text = await resp.text() + if resp.status == 200: + result = json.loads(text) return result['media_id'] else: - raise Exception(f"WeChat Upload Error: {result}") + raise Exception(f"WeChat Upload Error: {text}") finally: f.close() # 手动关闭