mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-26 13:15:39 -04:00
Get content length in HTTP request appropriately when using Python 3.
This commit is contained in:
parent
3f0f68b4de
commit
3a3df8a8bb
1 changed files with 4 additions and 1 deletions
|
|
@ -32,7 +32,10 @@ for f in files:
|
|||
req = urlopen(url)
|
||||
|
||||
# Get file size from header
|
||||
file_size = int(req.info().getheaders('Content-Length')[0])
|
||||
if sys.version_info[0] < 3:
|
||||
file_size = int(req.info().getheaders('Content-Length')[0])
|
||||
else:
|
||||
file_size = req.length
|
||||
downloaded = 0
|
||||
|
||||
# Check if file already downloaded
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue