Last active
April 7, 2017 10:09
-
-
Save seirl/64c9ef4c5e858dc05abe7b313a26a1e8 to your computer and use it in GitHub Desktop.
aiohttp: read request body with streaming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async def add_stream(request): | |
with open('/tmp/file', 'wb') as f: | |
async for chunk in request.content.iter_any(): | |
f.write(chunk) | |
return web.Response(text="Done!") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment