File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -314,8 +314,11 @@ def download(
314
314
f = output
315
315
316
316
if tmp_file is not None and f .tell () != 0 :
317
- headers = {"Range" : "bytes={}-" .format (f .tell ())}
317
+ start_size = f .tell ()
318
+ headers = {"Range" : "bytes={}-" .format (start_size )}
318
319
res = sess .get (url , headers = headers , stream = True , verify = verify )
320
+ else :
321
+ start_size = 0
319
322
320
323
if not quiet :
321
324
print (log_messages .get ("start" , "Downloading...\n " ), file = sys .stderr , end = "" )
@@ -337,9 +340,9 @@ def download(
337
340
try :
338
341
total = res .headers .get ("Content-Length" )
339
342
if total is not None :
340
- total = int (total )
343
+ total = int (total ) + start_size
341
344
if not quiet :
342
- pbar = tqdm .tqdm (total = total , unit = "B" , unit_scale = True )
345
+ pbar = tqdm .tqdm (total = total , unit = "B" , initial = start_size , unit_scale = True )
343
346
t_start = time .time ()
344
347
for chunk in res .iter_content (chunk_size = CHUNK_SIZE ):
345
348
f .write (chunk )
You can’t perform that action at this time.
0 commit comments