File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -73,18 +73,20 @@ def get_file(url, path):
73
73
if path and os .path .exists (path ):
74
74
buf = _open_output (path , 'ab' )
75
75
size = os .path .getsize (path )
76
+ success_codes = (200 , 206 )
76
77
else :
77
78
buf = _open_output (path )
78
79
size = 0
80
+ success_codes = (200 ,)
79
81
try :
80
82
c = _new_curl_object_for_url (url )
81
83
c .setopt (c .WRITEFUNCTION , buf .write )
82
84
if size > 0 :
83
85
log .info ('transfer of %s will resume at %s bytes' , url , size )
84
86
c .setopt (c .RESUME_FROM , size )
85
87
c .perform ()
86
- status_code = c .getinfo (HTTP_CODE )
87
- if int ( status_code ) != 200 :
88
+ status_code = int ( c .getinfo (HTTP_CODE ) )
89
+ if status_code not in success_codes :
88
90
message = GET_FAILED_MESSAGE % (url , status_code )
89
91
raise Exception (message )
90
92
finally :
You can’t perform that action at this time.
0 commit comments