bugfix
This commit is contained in:
parent
ba211de526
commit
0cdf3c5fc8
@ -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() # 手动关闭
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user