app=FastAPI()
@app.get('/zip_format')
def format_check():
    try:
        with zipfile.ZipFile('files.zip') as file:
            return {"Status:Ok"}
    except zipfile.BadZipFile:
        return {'Error: Zip file is corrupted'}
@app.get('/zip_display')
def convert_df():
    with zipfile.ZipFile("files.zip", mode="r") as archive:
        df = pd.DataFrame([(zinfo.filename,
                                datetime.datetime(*zinfo.date_time),
                                zinfo.file_size) for zinfo in archive.filelist],
                              columns=["filename",
                                       "date_time",
                                       "file_size"])
        json_compatible_item_data = jsonable_encoder(df)
        return JSONResponse(content=json_compatible_item_data)
I want to check my input zip file format and return status which I am able to do in my first method named as format_check.
How can I run my second method as a get method in FastApi to convert the data into dataframe and display the contents of zip file as json on UI?
 
    