MCPcopy Create free account
hub / github.com/aio-libs/aiohttp / stream

Function stream

tests/test_client_functional.py:2236–2241  ·  view source on GitHub ↗
(writer, fname)

Source from the content-addressed store, hash-verified

2234
2235 @aiohttp.streamer
2236 async def stream(writer, fname):
2237 with fname.open("rb") as f:
2238 data = await asyncio.to_thread(f.read, 100)
2239 while data:
2240 await writer.write(data)
2241 data = await asyncio.to_thread(f.read, 100)
2242
2243 async with client.post(
2244 "/", data=stream(fname), headers={"Content-Length": str(data_size)}

Callers 1

test_POST_STREAM_DATAFunction · 0.70

Calls 1

writeMethod · 0.45

Tested by

no test coverage detected