I am downloading a file using requests
:
import requests
req = requests.get(url, stream=True)
with open(local_filename, 'wb') as f:
for chunk in req.iter_content(chunk_size=1024):
if chunk:
f.write(chunk)
f.flush()
The problem with gzip files is that they being automatically decoded by requests, hence i get the unpacked file on disk, while i need the original file.
Is there a way to tell requests not to do this?