INNER CODE UNIT · Python
download_links
jlopp/lopp.net · check_links.py:137
async def download_links():
timeout = aiohttp.ClientTimeout(total=10)
async with aiohttp.ClientSession(
headers=headers, timeout=timeout
) as session:
tasks = []
for link in set_of_links:
task = asyncio.create_task(get_resp(session, link))
tasks.append(task)
await asyncio.gather(*tasks)
# Run the async function
asyncio.run(download_links())
# Clear the set of links
set_of_links = []