import requests
from pathlib import Path


def download_url(url,download_path):
    """
    Download an url
    url:           url to download
    download_path: path where to save the downloaded url
    """
    r = requests.get(url, stream = True)
    if not Path(download_path).exists():
        print("Downloading file {}".format(url)) 
        with open(download_path,"wb") as dest_file: 
            for chunk in r.iter_content(chunk_size=1024): 
                if chunk: 
                    dest_file.write(chunk)
        return 1
    else:
        return 0