From 82653ddfe58801c86cd9c073733cd6aeaa1032aa Mon Sep 17 00:00:00 2001 From: yumoqing Date: Tue, 2 Sep 2025 12:01:01 +0800 Subject: [PATCH] bugfix --- uapi/appapi.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/uapi/appapi.py b/uapi/appapi.py index 6b21abc..a3f8b7d 100644 --- a/uapi/appapi.py +++ b/uapi/appapi.py @@ -141,7 +141,8 @@ class UAPI: raise e if uapi.auth_apiname: auth_uapi = await sor_get_uapi(sor, upappid, iuapi.auth_apiname) - + self.uapi = uapi + self.auth_uapi = auth_uapi kinfo = await get_userapikey(sor, upappid, callerid) self.env.update(kinfo) return auth_uapi, uapi @@ -183,6 +184,10 @@ class UAPI: b = b'' async for chunk in self.__call__(upappid, apiname, callerid, params=params): b += chunk + if self.uapi.response: + dic = json.loads(b.decode('utf-8')) + s = self.rendertmpl(self.uapi.response, dic) + b = s.encode('utf-8') return b async def do_auth(self, auth_uapi): @@ -190,6 +195,9 @@ class UAPI: async for chunk in self.stream_resp(auth_uapi): b+= chunk d = json.loads(b.encode('utf-8')) + if auth_uapi.response: + s = self.rendertmpl(auth_uapi.response, d) + d = json.loads(s) self.env.update(d) return