From 0cdf3c5fc81d342fd730833759c3976a6a71c53d Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 3 Mar 2026 16:37:44 +0800 Subject: [PATCH] bugfix --- woa/media.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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() # 手动关闭