This commit is contained in:
yumoqing 2026-03-03 16:37:44 +08:00
parent ba211de526
commit 0cdf3c5fc8

View File

@ -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() # 手动关闭