raise http errors in downloadFile
This commit is contained in:
parent
009de1e688
commit
ecdeba8c72
1 changed files with 1 additions and 0 deletions
|
|
@ -2028,6 +2028,7 @@ def downloadFile(url, path=None, fo=None):
|
|||
fo.write(chunk)
|
||||
finally:
|
||||
resp.close()
|
||||
resp.raise_for_status()
|
||||
if resp.headers.get('Content-Length') and fo.tell() != int(resp.headers['Content-Length']):
|
||||
raise GenericError("Downloaded file %s doesn't match expected size (%s vs %s)" %
|
||||
(url, fo.tell(), resp.headers['Content-Length']))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue