File size: 318 Bytes
748e637
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
import zipfile, os

def zip_response(temp_zip_file: str, files: list):
    with zipfile.ZipFile(temp_zip_file, 'w') as zipf:
        for file in files:
            zipf.write(file, arcname=os.path.basename(file))
    with open(temp_zip_file, 'rb') as zip_file:
        zip_bytes = zip_file.read()
    return zip_bytes