def download_to_bytesio(url):
    """ Return a bytesio object with a download bar """
    logger.info("Downloading url: {0}".format(url))
    r = cleaned_request('get', url, stream=True)
    stream = io.BytesIO()
    total_length = int(r.headers.get('content-length'))
    for chunk in progress.bar(r.iter_content(chunk_size=1024), expected_size=(total_length/1024) + 1):
        if chunk:
            stream.write(chunk)
    stream.seek(0)
    return stream
def download_to_bytesio ( url ) : logger . info ( "Downloading url: {0}" . format ( url ) ) r = cleaned_request ( 'get' , url , stream = True ) stream = io . BytesIO ( ) total_length = int ( r . headers . get ( 'content-length' ) ) for chunk in progress . bar ( r . iter_content ( chunk_size = 1024 ) , expected_size = ( total_length / 1024 ) + 1 ) : if chunk : stream . write ( chunk ) stream . seek ( 0 ) return stream
Return a bytesio object with a download bar