مساعدة في طريقة اعادة تحميل ملف من المكان الذي توقف عنده اثناء انقطاع الانترنت
def resume(url, fullpath, byte):
#print (byte)
#ss= raw_input("TotalSize2: ")
re = urllib2.Request(url)
re.headers['Range'] = 'bytes={}'.format(byte)
rv = urllib2.urlopen(re)
Size = byte.split('-')
done = int(Size[0])
#fullpath = "سلامظ?؟m|m.mp4"
fullpath = "mmm.ogv"
#fullpath = re.sub(r'[^\w]', ' ', fullpath)
f = open(fullpath, 'ab')
buff = rv.read(1024)
#tt= raw_input("Pause Buff")
gg = 0
while buff:
f.write(buff)
done += 1024
percent = int(done * 100 / int(Size[1]))
#print ("\r Downloading... [{} %]".format(percent))#,
try:
buff = rv.read(1024)
except :
time.sleep(1)
continue