fix: 修复响应体读取错误
This commit is contained in:
@@ -35,8 +35,8 @@ async def upload_file(file_path: str, filename: str = "None") -> str:
|
|||||||
async with httpx.AsyncClient(timeout=30) as client:
|
async with httpx.AsyncClient(timeout=30) as client:
|
||||||
resp = await client.post(url, files=files, headers=headers)
|
resp = await client.post(url, files=files, headers=headers)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
data = resp.json()
|
data = resp.json().get("data")
|
||||||
return data.get("data", data.get("files", [None])[0])
|
return data.get("path", data.get("files", [None])[0])
|
||||||
|
|
||||||
|
|
||||||
async def send_webhook(group_id: str, file_url: str) -> dict:
|
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 响应字典
|
API 响应字典
|
||||||
"""
|
"""
|
||||||
remote_path = await upload_file(file_path, filename)
|
remote_path = await upload_file(file_path, filename)
|
||||||
|
print(remote_path)
|
||||||
result = await send_webhook(group_id, remote_path)
|
result = await send_webhook(group_id, remote_path)
|
||||||
return result
|
return result
|
||||||
|
|||||||
Reference in New Issue
Block a user