def download_with_progress(url, chunk_size, **progress_kwargs):
 resp = requests.get(url, stream=True)
 resp.raise_for_status()
 total_size = int(resp.headers['content-length'])
 data = BytesIO()
 with progressbar(length=total_size, **progress_kwargs) as pbar:
  for chunk in resp.iter_content(chunk_size=chunk_size):
   data.write(chunk)
   pbar.update(len(chunk))
 data.seek(0)
 return data

def download_with_progress ( url , chunk_size , ** progress_kwargs ) : resp = requests . get ( url , stream = True ) resp . raise_for_status ( ) total_size = int ( resp . headers [ 'content-length' ] ) data = BytesIO ( ) with progressbar ( length = total_size , ** progress_kwargs ) as pbar : for chunk in resp . iter_content ( chunk_size = chunk_size ) : data . write ( chunk ) pbar . update ( len ( chunk ) ) data . seek ( 0 ) return data
download streaming data from a url .