1
async def download(url):
    response = await aiohttp.request('GET', url)
    raw_html = await response.read()
    return raw_html

for url in urls:
    await download(url)

suppose I have the code above, will the url be downloaded one by one? or will they be downloaded parallelly?

ospider
  • 9,334
  • 3
  • 46
  • 46
  • I think what I need was `asyncio.gather`, but I'm not sure, yet – ospider Jun 13 '17 at 02:39
  • I'm not really familiar with Python's async/await, but checking around in the docs, it looks to me like you are right about asyncio.gather (see in particular ch. 18.5.3.5.1 - Example: Parallel execution of tasks for v 3.6.1). See also https://stackoverflow.com/questions/42231161/asyncio-gather-vs-asyncio-wait. – Jarak Jun 13 '17 at 04:41

0 Answers0