import aiohttp
import asyncio
async def stream_response():
async with aiohttp.ClientSession() as session:
async with session.post('your url',headers={"xxx": "xxx"},data='{"xxx": "xxx"}') as response:
async for line in response.content.iter_any():
print(line.decode(),end='')
async def main():
await stream_response()
asyncio.run(main())
python如何实现流式接收数据
最新推荐文章于 2024-07-20 17:12:48 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)