12345678910111213141516171819202122232425262728293031323334 |
- from fastapi import FastAPI
- import sys
- import os
- sys.path.insert(0,'.')
- import bhouse_lib
- app = FastAPI()
- @app.get("/items/{item_id}")
- async def read_item(item_id):
- return {"item_id": item_id}
- @app.get("/bhouse/{month_num}")
- async def montyly_rep(month_num):
- rep=bhouse_lib.get_monthly_report(int(month_num))
- return {"results": rep}
- @app.get("/bhouse/kw/{month_num}")
- async def montyly_kw(month_num):
- rep=bhouse_lib.get_monthly_report(int(month_num))
- results=[]
- for r in rep:
- if r[4] <=4:
- results.append(r)
- return {"results": results}
- @app.get("/")
- async def root():
- return {"message": "Hello World"}
|