FOIA_Doc_Search / export /journalist_zip.py
GodsDevProject's picture
Create export/journalist_zip.py
bcc6c37 verified
raw
history blame
257 Bytes
import zipfile, io
def export_zip(results):
buf = io.BytesIO()
with zipfile.ZipFile(buf, "w") as z:
for i, r in enumerate(results):
z.writestr(f"{i}_{r['agency']}.txt", f"{r['title']}\n{r['url']}")
buf.seek(0)
return buf