bugfix
This commit is contained in:
parent
3a4ef54399
commit
6d700279fe
@ -187,13 +187,13 @@ async def downloadfile(url, headers=None, params=None, data={}):
|
|||||||
fs = FileStorage()
|
fs = FileStorage()
|
||||||
fpath = fs._name2path(filename, userid='tmp')
|
fpath = fs._name2path(filename, userid='tmp')
|
||||||
try:
|
try:
|
||||||
shc = StreamHttpClient()
|
|
||||||
async with aiofiles.open(fpath,'wb') as f:
|
async with aiofiles.open(fpath,'wb') as f:
|
||||||
|
shc = StreamHttpClient()
|
||||||
async for chunk in shc('GET', url,
|
async for chunk in shc('GET', url,
|
||||||
headers=headers,
|
headers=headers,
|
||||||
params=params,
|
params=params,
|
||||||
data=data):
|
data=data):
|
||||||
f.write(chunk)
|
await f.write(chunk)
|
||||||
return fpath
|
return fpath
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
exception(f'save {url} to {fpath} exception:{e}')
|
exception(f'save {url} to {fpath} exception:{e}')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user