retrieval.py 文件源码

python
阅读 48 收藏 0 点赞 0 评论 0

项目:hdx-data-freshness 作者: OCHA-DAP 项目源码 文件源码
def check_urls(urls, loop):
    tasks = list()

    conn = aiohttp.TCPConnector(limit=100, limit_per_host=2, loop=loop)
    async with aiohttp.ClientSession(connector=conn, read_timeout=300, conn_timeout=10, loop=loop) as session:
        for metadata in urls:
            task = fetch(metadata, session)
            tasks.append(task)
        responses = dict()
        for f in tqdm.tqdm(asyncio.as_completed(tasks), total=len(tasks)):
            resource_id, url, err, http_last_modified, hash, force_hash = await f
            responses[resource_id] = (url, err, http_last_modified, hash, force_hash)
        return responses
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号