bugfix
This commit is contained in:
parent
97d6e23f51
commit
b6f2607b26
@ -167,6 +167,11 @@ class UAPI:
|
||||
async for chunk in self.stream_resp(uapi):
|
||||
yield chunk
|
||||
|
||||
def filter_nl_cr(self, s):
|
||||
s = ''.join(s.split('\n'))
|
||||
s = ''.join(s.split('\r'))
|
||||
return s
|
||||
|
||||
async def stream_linify(self, upappid, apiname, callerid, params={}):
|
||||
gen = liner(self.__call__(upappid, apiname, callerid, params=params))
|
||||
async for line in gen:
|
||||
@ -182,11 +187,12 @@ class UAPI:
|
||||
try:
|
||||
dic = json.loads(line.decode('utf-8'))
|
||||
line = self.rendertmpl(self.uapi.response, dic)
|
||||
line = self.filter_nl_cr(line)
|
||||
except Exception as e:
|
||||
debug(f'{line=}, {self.uapi.response=} error({e})\n{format_exc()}')
|
||||
pass
|
||||
if len(line):
|
||||
yield f'{json.dumps(line)}\n'
|
||||
yield f'{line}\n'
|
||||
else:
|
||||
debug(f'invalid line:{line}')
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user