I am making a get request using Python's requests library and streaming the contents into a file. I'd like to add a progress bar by setting the max value of the progress bar to resp.headers['content-length'] and iterating through the response using chunksize=1 byte (response.iter_content(chunk_size=1)). However, the content encoding of the response is gzip so the content-length refers to the compressed size.
using the following code:
resp = requests.get(...., stream=True)
count = 0
for x in resp.iter_content(chunk_size=1):
count += 1
i get: count=64 and resp.headers['content-length'] = 127.
What should I use as the max value of the progress bar?