bytes = 'blah blah blah'
zip = zipfile.ZipFile(buffer, 'w', zipfile.ZIP_DEFLATED)
info = zipfile.ZipInfo(name)
info.external_attr = 511 << 16
zip.writestr(info, bytes)
zip.close()
How do I set permissions (attributes) on a file in a ZIP file using Python's zipfile module?