diff --git a/FastAPI test 1000 requests.png b/FastAPI test 1000 requests.png new file mode 100644 index 0000000..a86b656 Binary files /dev/null and b/FastAPI test 1000 requests.png differ diff --git a/__pycache__/newMain.cpython-312.pyc b/__pycache__/newMain.cpython-312.pyc new file mode 100644 index 0000000..53923eb Binary files /dev/null and b/__pycache__/newMain.cpython-312.pyc differ diff --git a/newMain.py b/newMain.py new file mode 100644 index 0000000..ed64afa --- /dev/null +++ b/newMain.py @@ -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 + ) \ No newline at end of file diff --git a/testhttp.py b/testhttp.py index a37ca2d..b5067e5 100644 --- a/testhttp.py +++ b/testhttp.py @@ -15,4 +15,4 @@ def BenchMarkDjango(): if __name__ == "__main__": djangoTime = timeit.timeit(stmt=BenchMarkDjango, number=10) pythonTime = timeit.timeit(stmt=BenchMarkServer, number=10) - print(f"Django: {djangoTime}\nPython: {pythonTime}") \ No newline at end of file + print(f"FastAPI: {djangoTime}\nPython: {pythonTime}") \ No newline at end of file