()
Download the news data
Download the news data
Download the news data
def download_the_news_data():
    """Download the news data"""
    LOGGER.info("Downloading")
    try:
        os.makedirs(os.path.dirname(NEWS_FILE_NAME_COMPRESSED))
    except OSError as exception:
        if exception.errno != errno.EEXIST:
            raise
    with open(NEWS_FILE_NAME_COMPRESSED, "wb") as output_file:
        response = requests.get(DATA_FILES_URL, stream=True)
        total_length = response.headers.get('content-length')
        downloaded = percentage = 0
        print("»"*100)
        total_length = int(total_length)
        for data in response.iter_content(chunk_size=4096):
            downloaded += len(data)
            output_file.write(data)
            new_percentage = 100 * downloaded // total_length
            if new_percentage > percentage:
                print("☑", end="")
                percentage = new_percentage
    print()
def download_the_news_data ( ) : LOGGER . info ( "Downloading" ) try : os . makedirs ( os . path . dirname ( NEWS_FILE_NAME_COMPRESSED ) ) except OSError as exception : if exception . errno != errno . EEXIST : raise with open ( NEWS_FILE_NAME_COMPRESSED , "wb" ) as output_file : response = requests . get ( DATA_FILES_URL , stream = True ) total_length = response . headers . get ( 'content-length' ) downloaded = percentage = 0 print ( "»"* 1 00) total_length = int ( total_length ) for data in response . iter_content ( chunk_size = 4096 ) : downloaded += len ( data ) output_file . write ( data ) new_percentage = 100 * downloaded // total_length if new_percentage > percentage : print ( "☑",  e d=" " ) percentage = new_percentage print ( )