在链接https://zetcode.com/python/httpx/中,它具有以下流示例
import httpx
url = 'https://download.freebsd.org/ftp/releases/amd64/amd64/ISO-IMAGES/12.0/FreeBSD-12.0-RELEASE-amd64-mini-memstick.img'
with open('FreeBSD-12.0-RELEASE-amd64-mini-memstick.img', 'wb') as f:
with httpx.stream('GET', url) as r:
for chunk in r.iter_bytes():
f.write(chunk)
它是一种异步传输数据的方法吗?例如
async def stream(call_back):
async with httpx.stream('GET', url) as r:
for chunk in await? r.iter_bytes():
await call_back(chunk)