MCPcopy Index your code
hub / github.com/geekcomputers/Python / async_downloader

Function async_downloader

async_downloader/async_downloader.py:46–62  ·  view source on GitHub ↗
(ways, loop, success_files, failure_files)

Source from the content-addressed store, hash-verified

44
45
46async def async_downloader(ways, loop, success_files, failure_files):
47 async with aiohttp.ClientSession() as session:
48 coroutines = [
49 download_file_by_url(
50 url,
51 session=session,
52 )
53 for url in ways
54 ]
55
56 for task in asyncio.as_completed(coroutines):
57 fail, url = await task
58
59 if fail:
60 failure_files.add(url)
61 else:
62 success_files.add(url)
63
64
65async def download_file_by_url(url, session=None):

Callers 1

downloadFunction · 0.85

Calls 2

download_file_by_urlFunction · 0.85
addMethod · 0.45

Tested by

no test coverage detected