from starlette.responses import FileResponse
import uvicorn


#from service import minm
from fastapi import FastAPI
#from service import monthlytempdata
from code import weeklytempdata, dailytempdata, monthlytempdata
from qu import *

app = FastAPI()
@app.get("/getData1")
def monthlytempdata1():
    fpath,fname = monthlytempdata()
    return FileResponse(fpath, media_type='application/octet-stream', filename=fname)

@app.get("/getData2")
def dailytempdata1():
    fpath,fname = dailytempdata()
    return FileResponse(fpath, media_type='application/octet-stream', filename=fname)

@app.get("/getData3")
def weeklytempdata1():
    fpath, fname = weeklytempdata()
    return FileResponse(fpath, media_type='application/octet-stream',filename=fname)

if __name__ == '__main__':
    uvicorn.run('appi:app')