Download without status updates if server does not report file size. Closes #771.
This commit is contained in:
parent
49583ccfab
commit
3d8876bf59
|
@ -139,7 +139,13 @@ class Resolver:
|
|||
else:
|
||||
resp = urllib.request.urlopen(url)
|
||||
with contextlib.closing(resp) as resp:
|
||||
dlsize = int(resp.info()['Content-Length'])
|
||||
try:
|
||||
dlsize = int(resp.info()['Content-Length'])
|
||||
except TypeError:
|
||||
dlsize = None
|
||||
if dlsize is None:
|
||||
print('Downloading file of unknown size.')
|
||||
return resp.read()
|
||||
print('Download size:', dlsize)
|
||||
print('Downloading: ', end='')
|
||||
sys.stdout.flush()
|
||||
|
|
Loading…
Reference in New Issue