Example #1
0
        async def home():
            async def slow_streaming():
                for _ in range(0, 5):
                    yield b'123'
                    await asyncio.sleep(1)

            return StreamingResponse(slow_streaming)
Example #2
0
async def stream(request: Request):
    async def stream_builder():
        for x in range(0, 5):
            yield str(x).encode()
            await asyncio.sleep(1)

    return StreamingResponse(stream_builder,
                             chunk_timeout=10,
                             complete_timeout=30)
Example #3
0
 async def home():
     return StreamingResponse(generator)
Example #4
0
 async def home():
     return StreamingResponse(stream,
                              chunk_timeout=3,
                              complete_timeout=999)
Example #5
0
 async def home():
     return StreamingResponse(stream, complete_timeout=1)
Example #6
0
 async def home():
     return StreamingResponse(stream)
Example #7
0
async def home():
    return StreamingResponse(b'123')