Skip to content

Instantly share code, notes, and snippets.

@seirl
Last active April 7, 2017 10:09
Show Gist options
  • Save seirl/64c9ef4c5e858dc05abe7b313a26a1e8 to your computer and use it in GitHub Desktop.
Save seirl/64c9ef4c5e858dc05abe7b313a26a1e8 to your computer and use it in GitHub Desktop.
aiohttp: read request body with streaming
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