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