main.py 470 B

12345678910111213141516171819202122232425
  1. from fastapi import FastAPI
  2. import sys
  3. import os
  4. sys.path.insert(0,'.')
  5. import bhouse_lib
  6. app = FastAPI()
  7. @app.get("/items/{item_id}")
  8. async def read_item(item_id):
  9. return {"item_id": item_id}
  10. @app.get("/bhouse/{month_num}")
  11. async def montyly_rep(month_num):
  12. rep=bhouse_lib.get_monthly_report(month_num)
  13. lst=[]
  14. for r in rep:
  15. lst.append(r[0])
  16. return {"results": lst}
  17. @app.get("/")
  18. async def root():
  19. return {"message": "Hello World"}