feat(Packagers): tested out FastAPI its a great wrapper comes with auto docs/test tool that shows how to do the api request, marginally slower

This commit is contained in:
darkicewolf50
2024-11-28 17:50:02 +00:00
parent 0276fea6e7
commit fcbee342b3
4 changed files with 44 additions and 1 deletions

43
newMain.py Normal file
View File

@ -0,0 +1,43 @@
import json
from fastapi import FastAPI
from fastapi.responses import JSONResponse
app = FastAPI()
@app.get("/")
def get_root():
res = {"message": "Hello World"}
# Return the response with the custom header
return JSONResponse(
headers={
"isBase64Encoded": "false", # Header Modification
},
content={
"body": res
},
# status_code=200 commented out just to show how to change it if you wanted
)
# # Set headers
# headers = {
# "isBase64Encoded": "false", # Header Modification
# }
from GetSchedulePackager import getSchedulePackager
@app.get("/getSchedule")
def getSchedule():
res = getSchedulePackager()
return JSONResponse(
headers={
"isBase64Encoded": "false", # Header Modification
},
content={
"body": res
},
# status_code=200 commented out just to show how to change it if you wanted
)