bugfix
This commit is contained in:
parent
3631a09f72
commit
03df5bf3b1
@ -10,6 +10,23 @@ import ssl
|
|||||||
import os
|
import os
|
||||||
from appPublic.log import exception, debug
|
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:
|
class StreamHttpClient:
|
||||||
def __init__(self, socks5_url="socks5://127.0.0.1:1086"):
|
def __init__(self, socks5_url="socks5://127.0.0.1:1086"):
|
||||||
home = os.path.expanduser("~")
|
home = os.path.expanduser("~")
|
||||||
|
Loading…
Reference in New Issue
Block a user