import requests
from tqdm.auto import tqdm
from pathlib import Path 

def download(URL:str, output_path: Path):
    response = requests.get(URL, stream=True)
    total_size_in_bytes= int(response.headers.get('content-length', 0))
    block_size = 1024 
    progress_bar = tqdm(total=total_size_in_bytes, unit='iB', unit_scale=True)
    with open(output_path, 'wb') as file:
        for data in response.iter_content(block_size):
            progress_bar.update(len(data))
            file.write(data)
    progress_bar.close()