fix: 修复响应体读取错误

This commit is contained in:
2026-05-29 11:09:15 +08:00
parent 14e064c0d2
commit fb5357b554

View File

@@ -35,8 +35,8 @@ async def upload_file(file_path: str, filename: str = "None") -> str:
async with httpx.AsyncClient(timeout=30) as client:
resp = await client.post(url, files=files, headers=headers)
resp.raise_for_status()
data = resp.json()
return data.get("data", data.get("files", [None])[0])
data = resp.json().get("data")
return data.get("path", data.get("files", [None])[0])
async def send_webhook(group_id: str, file_url: str) -> dict:
@@ -84,5 +84,6 @@ async def upload_and_notify(file_path: str, group_id: str, filename: str = "") -
API 响应字典
"""
remote_path = await upload_file(file_path, filename)
print(remote_path)
result = await send_webhook(group_id, remote_path)
return result