Commit 1265e9eb by mohammed.shibili

corrections done

parent 3a694a1d
......@@ -38,6 +38,7 @@ class OperationsOnApi:
values = list(self.collection_name.aggregate(self.data_to_exel))
dataframe = pd.DataFrame(values)
dataframe.to_excel(Endpoints().folder + Endpoints().exel_file)
# download file
return f'data inserted to path {Endpoints().folder}{Endpoints().exel_file}'
except Exception as e:
return "exel conversion failed", e
from fastapi import APIRouter, UploadFile
from fastapi import APIRouter, UploadFile, Response
from scripts.core.handlers.api_function import OperationsOnApi
from scripts.constants.const import Endpoints
......@@ -31,4 +31,5 @@ async def get_no_violation():
@files.get(Endpoints().get_to_exel, tags=['Aggregation'])
async def convert_exel():
print(OperationsOnApi().create_exel_file())
return "exel file created"
return Response(content=open(Endpoints().folder + Endpoints().exel_file, "rb").read(),
media_type="application/msexcel")
No preview for this file type
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment