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
import asyncio | |
from contextlib import closing | |
import aiohttp | |
async def download_file(session: aiohttp.ClientSession, url: str): | |
async with session.get(url) as response: | |
assert response.status == 200 | |
# For large files use response.content.read(chunk_size) instead. |