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)
评论列表
文章目录