0

try:

query = "select path from tableName where runid='4e9988-b6a8';"
response = session.execute(query)
for i in response:
    if i is not None:
            resp = Response(i, media_type="application/x-zip-compressed",
                            headers={
                                'Content-Disposition': 'attachment;filename=log.zip'
                            })
            print("res", res.headers)
            print("res", res)
        return res
except Exception as e:
    print(e)

response object is like:

Row(resultpath=b'PK\x03\x04\x14\x00\x00\x00\x00\x00(o\x8dS\x86(\xb0\xd6\x17\x00\x00\x00\x17\x00\x00\x00\x12\x00\x00\x00zipTrial/hello.txthello all i am visionPK\x01\x02\x14\x00\x14\x00\x00\x00\x00\x00(o\x8dS\x86(\xb0\xd6\x17\x00\x00\x00\x17\x00\x00\x00\x12\x00\x00\x00\x00\x00\x00\x00\x01\x00 \x00\x00\x00\x00\x00\x00\x00zipTrial/hello.txtPK\x05\x06\x00\x00\x00\x00\x01\x00\x01\x00@\x00\x00\x00G\x00\x00\x00\x00\x00')

vision
  • 25
  • 7
  • I dont see how to download file here.. sorry , can you help me out – vision Dec 14 '21 at 08:10
  • Does this answer your question? [Download a file from a Flask-based Python server](https://stackoverflow.com/questions/37937091/download-a-file-from-a-flask-based-python-server) – Kris Dec 14 '21 at 08:35
  • @Kris somewhat same. But here i am using Fastapi. And i want to download a zip file which is in byte format in fastapi blob – vision Dec 14 '21 at 08:56
  • 1
    Over here [FastAPI Download](https://stackoverflow.com/questions/60716529/download-file-using-fastapi) – Kris Dec 14 '21 at 09:55

0 Answers0