bugfix
This commit is contained in:
parent
27a3d91578
commit
109699c287
@ -122,7 +122,7 @@ class UAPI:
|
|||||||
self.auth_ret = None
|
self.auth_ret = None
|
||||||
self.sor = sor
|
self.sor = sor
|
||||||
|
|
||||||
async def rendertmpl(self, tmplstr, params={}):
|
def rendertmpl(self, tmplstr, params={}):
|
||||||
if tmplstr is None:
|
if tmplstr is None:
|
||||||
return None
|
return None
|
||||||
ns = self.env.copy()
|
ns = self.env.copy()
|
||||||
@ -170,6 +170,7 @@ class UAPI:
|
|||||||
async def stream_linify(self, upappid, apiname, callerid, params={}):
|
async def stream_linify(self, upappid, apiname, callerid, params={}):
|
||||||
gen = liner(self.__call__(upappid, apiname, callerid, params=params))
|
gen = liner(self.__call__(upappid, apiname, callerid, params=params))
|
||||||
async for line in gen:
|
async for line in gen:
|
||||||
|
debug(f'{line=},{type(line)=}')
|
||||||
filter = self.uapi.chunk_match
|
filter = self.uapi.chunk_match
|
||||||
if filter:
|
if filter:
|
||||||
filter = filter.encode('utf-8')
|
filter = filter.encode('utf-8')
|
||||||
@ -208,13 +209,13 @@ class UAPI:
|
|||||||
async def stream_resp(self, api):
|
async def stream_resp(self, api):
|
||||||
url = self.env.get('baseurl') + api.path
|
url = self.env.get('baseurl') + api.path
|
||||||
method = api.httpmethod
|
method = api.httpmethod
|
||||||
headers = await self.rendertmpl(api.headers)
|
headers = self.rendertmpl(api.headers)
|
||||||
try:
|
try:
|
||||||
headers = json.loads(headers)
|
headers = json.loads(headers)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}, {headers=},{api.headers=}')
|
exception(f'{e}, {headers=},{api.headers=}')
|
||||||
raise e
|
raise e
|
||||||
body = await self.rendertmpl(api.data)
|
body = self.rendertmpl(api.data)
|
||||||
if body:
|
if body:
|
||||||
try:
|
try:
|
||||||
bdy = json.loads(body)
|
bdy = json.loads(body)
|
||||||
@ -222,7 +223,7 @@ class UAPI:
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'{e}, {body=},{api.data=}')
|
exception(f'{e}, {body=},{api.data=}')
|
||||||
body = None
|
body = None
|
||||||
_params = await self.rendertmpl(api.params)
|
_params = self.rendertmpl(api.params)
|
||||||
if _params:
|
if _params:
|
||||||
_params = json.loads(_params)
|
_params = json.loads(_params)
|
||||||
debug(f'{headers=}, {body=}. {method=}, {url=}')
|
debug(f'{headers=}, {body=}. {method=}, {url=}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user