When you do files = zip_file.namelist(), you simply specify the file names in the zip archive; these files are not yet extracted from zip, and you cannot openthem as local files, for example, you do.
You can directly read the data stream from a zip file using ZipFile.open.
So this should work:
zip_file = ZipFile(BytesIO(request.content))
files = zip_file.namelist()
with zip_file.open(files[0], 'r') as csvfile:
csvreader = csv.reader(csvfile)
...
source
share