china_bond.py 文件源码

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

项目:chinabond 作者: muxuezi 项目源码 文件源码
def get_async(ym, x):
    '''
    ??GET????xls????
    parameters
    ==========
    ym : str
        ??
    x : dict
        ???????
    '''
    with (await sem):
        name, sid = x['name'], x['sid']
        url = 'http://www.chinabond.com.cn/DownLoadxlsx?sId={}&sBbly={}&sMimeType=4'.format(
            sid, ym)
        outfilename = 'data/{}{}{}.xls'.format(sid, name, ym)
        logging.info('downloading %s', outfilename)
        response = await aiohttp.request('GET', url, headers=headers)
        with closing(response), open(outfilename, 'wb') as file:
            while True:  # ????
                chunk = await response.content.read(1024)
                if not chunk:
                    break
                file.write(chunk)
        logging.info('done %s', outfilename)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号