import time
from selenium import webdriver
import requests
import threading
import os
defHandler(start, end, url, filename):# specify the starting and ending of the file
headers ={
'Range':'bytes=%d-%d'%(start, end)}# request the specified part and get into variable
r = requests.get(url, headers=headers, stream=True)# open the file and write the content of the html page into file. withopen(filename,"r+b")as fp:
fp.seek(start)
var = fp.tell()
fp.write(r.content)defdownload_file(url_of_file,name,number_of_threads):
r = requests.head(url_of_file)if name:
file_name = name
else:
file_name = url_of_file