(url, sourcefile, destfile, totalsz)
Download the file specified by the given URL.

        Args:
            url (str): Base URL of the file to be downloaded.
            sourcefile (str): Name of the source file.
            destfile (str): Path to the destination.
            totalsz (int): Size of the file to be downloaded.
Download the file specified by the given URL.
Download the file specified by the given URL .
def fetch_dataset(url, sourcefile, destfile, totalsz):
        """
        Download the file specified by the given URL.

        Args:
            url (str): Base URL of the file to be downloaded.
            sourcefile (str): Name of the source file.
            destfile (str): Path to the destination.
            totalsz (int): Size of the file to be downloaded.
        """
        req = Request(os.path.join(url, sourcefile), headers={'User-Agent': 'neon'})
        # backport https limitation and workaround per http://python-future.org/imports.html
        cloudfile = urlopen(req)
        neon_logger.display("Downloading file: {}".format(destfile))
        blockchar = u'\u2588'  # character to display in progress bar
        with open(destfile, 'wb') as f:
            data_read = 0
            chunksz = 1024**2
            while 1:
                data = cloudfile.read(chunksz)
                if not data:
                    break
                data_read = min(totalsz, data_read + chunksz)
                progress_string = u'Download Progress |{:<50}| '.format(
                    blockchar * int(float(data_read) / totalsz * 50))
                sys.stdout.write('\r')
                if PY3:
                    sys.stdout.write(progress_string)
                else:
                    sys.stdout.write(progress_string.encode("utf-8"))
                sys.stdout.flush()

                f.write(data)
            neon_logger.display("Download Complete")
def fetch_dataset ( url , sourcefile , destfile , totalsz ) : req = Request ( os . path . join ( url , sourcefile ) , headers = { 'User-Agent' : 'neon' } ) # backport https limitation and workaround per http://python-future.org/imports.html cloudfile = urlopen ( req ) neon_logger . display ( "Downloading file: {}" . format ( destfile ) ) blockchar = u'\u2588' # character to display in progress bar with open ( destfile , 'wb' ) as f : data_read = 0 chunksz = 1024 ** 2 while 1 : data = cloudfile . read ( chunksz ) if not data : break data_read = min ( totalsz , data_read + chunksz ) progress_string = u'Download Progress |{:<50}| ' . format ( blockchar * int ( float ( data_read ) / totalsz * 50 ) ) sys . stdout . write ( '\r' ) if PY3 : sys . stdout . write ( progress_string ) else : sys . stdout . write ( progress_string . encode ( "utf-8" ) ) sys . stdout . flush ( ) f . write ( data ) neon_logger . display ( "Download Complete" )