调整json格式存储link信息

This commit is contained in:
liuwei
2025-06-10 15:13:37 +08:00
parent 1d61576ae7
commit 8ebe09eeb5
3 changed files with 80 additions and 26 deletions

View File

@@ -69,9 +69,9 @@ class ToolMixin(WechatAPIClientBase):
return json_resp.get("Data").get("data").get("buffer")
else:
self.error_handler(json_resp)
async def download_attach_xml(self, xml_str: str) -> str:
#读取消息信息,进行处理
async def download_attach_xml(self, xml_str: str) -> str:
# 读取消息信息,进行处理
import xml.etree.ElementTree as ET
root = ET.fromstring(xml_str)
appmsg = root.find("appmsg")
@@ -146,6 +146,22 @@ class ToolMixin(WechatAPIClientBase):
else:
self.error_handler(json_resp)
async def friend_circle_upload(self, base64: str) -> str:
# / FriendCircle / Upload
if not self.wxid:
raise UserLoggedOut("请先登录")
async with aiohttp.ClientSession() as session:
json_param = {"Wxid": self.wxid, "Base64": base64}
response = await session.post(f'http://{self.ip}:{self.port}/api/FriendCircle/Upload', json=json_param)
json_resp = await response.json()
if json_resp.get("Success"):
return json_resp.get("Data").get("ThumbUrls")[0].get("Url")
else:
self.error_handler(json_resp)
async def set_step(self, count: int) -> bool:
"""设置步数。