projects
/
winfreed.git
/ commitdiff
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
036da88
)
winfreed.py: check if Content-Length is available before downloading
author
Antonio Ospite <ao2@ao2.it>
Sun, 30 Aug 2015 10:31:23 +0000
(12:31 +0200)
committer
Antonio Ospite <ao2@ao2.it>
Sun, 30 Aug 2015 10:31:23 +0000
(12:31 +0200)
winfreed.py
patch
|
blob
|
history
diff --git
a/winfreed.py
b/winfreed.py
index
0492028
..
a9af707
100755
(executable)
--- a/
winfreed.py
+++ b/
winfreed.py
@@
-108,6
+108,10
@@
def download_file(src_url, dest_dir):
sys.stderr.write("Warning: %s exists!\n" % destfile)
return
sys.stderr.write("Warning: %s exists!\n" % destfile)
return
+ if 'Content-Length' not in response.info():
+ sys.stderr.write("Cannot get the size of the file at %s\n" % src_url)
+ return
+
total_size = response.info().getheader('Content-Length').strip()
total_size = int(total_size)
total_size = response.info().getheader('Content-Length').strip()
total_size = int(total_size)