import requests
from tqdm import tqdm
def download_file(url, filename):
with requests.get(url, stream=True) as response:
response.raise_for_status()
total_size_in_bytes = int(response.headers.get('content-length', 0))
block_size = 1024 # 1 Kibibyte
progress_bar = tqdm(total=total_size_in_bytes, unit='iB', unit_scale=True)
with open(filename, 'wb') as file:
for chunk in response.iter_content(chunk_size=block_size):
progress_bar.update(len(chunk))
file.write(chunk)
progress_bar.close()
Tuesday, 12 March 2024
Python: Download file in chunks with progress bar
Subscribe to:
Post Comments (Atom)
How whey is made
Source: https://www.youtube.com/watch?v=LeUZmojH7p8 Start with Milk, homogenize, pasteurize. It is 87% water, 5% lactose, 3.5% fat, 3.5...
-
""" This module processes Wikipedia dump files by extracting individual articles and parsing them into a structured format, ...
-
2 Million renderings took 0.875s import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.util.HashMap;...
-
docker pull quay.io/unstructured-io/unstructured-api 20gb image. After docker-pull: docker image inspect --format '{{json .}}' ...
No comments:
Post a Comment