This commit is contained in:
ymq1 2025-06-11 09:09:14 +00:00
parent 3631a09f72
commit 03df5bf3b1

View File

@ -10,6 +10,23 @@ import ssl
import os
from appPublic.log import exception, debug
async def liner(async_gen):
remainer = ''
async for chunk in async_gen:
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
class StreamHttpClient:
def __init__(self, socks5_url="socks5://127.0.0.1:1086"):
home = os.path.expanduser("~")