This commit is contained in:
yumoqing 2025-07-10 11:27:25 +08:00
parent 94b497081c
commit 4cb71227a1

View File

@ -11,21 +11,17 @@ import os
from appPublic.log import exception, debug
async def liner(async_gen):
remainer = ''
remainer = b''
async for chunk in async_gen:
chunk = chunk.decode('utf-8')
# chunk = chunk.decode('utf-8')
d = remainer + chunk
lst = d.split('\n', 1)
if len(lst) == 2:
if lst[0]:
yield lst[0]
remainer = lst[1]
else:
remainer = lst[0]
for l in remainer.split('\n'):
if l:
await asyncio.sleep(0)
yield l
lst = d.split(b'\n')
cnt = len(lst)
for c in range(cnt-1):
yield lst[c]
remainer = lst[-1]
if remainer != b'':
yield remainer
def get_non_verify_ssl():
ssl_context = ssl.create_default_context(cafile=certifi.where())