I adjusted the code a bit and it worked for me.
import json
import quart
import quart_cors
from quart import requestapp = quart.Quart(name)
app = quart_cors.cors(app, allow_origin=“*”)_TODOS = {}
@app.post(“/todos/string:username”)
async def add_todo(username):
req_data = await request.get_json(force=True)
if username not in _TODOS:
_TODOS[username] =
_TODOS[username].append(req_data[“todo”])
return quart.Response(response=‘OK’, status=200)@app.get(“/todos/string:username”)
async def get_todos(username):
return quart.Response(response=json.dumps(_TODOS.get(username, )), status=200)@app.delete(“/todos/string:username”)
async def delete_todo(username):
req_data = await request.get_json(force=True)
todo_idx = req_data[“todo_idx”]
if 0 <= todo_idx < len(_TODOS.get(username, )):
_TODOS[username].pop(todo_idx)
return quart.Response(response=‘OK’, status=200)@app.get(“/logo.png”)
async def plugin_logo():
filename = ‘logo.png’
return await quart.send_file(filename, mimetype=‘image/png’)@app.get(“/.well-known/ai-plugin.json”)
async def plugin_manifest():
host = request.headers[‘Host’]
with open(“./.well-known/ai-plugin.json”) as f:
text = f.read()
return quart.Response(text, mimetype=“text/json”)@app.get(“/openapi.yaml”)
async def openapi_spec():
host = request.headers[‘Host’]
with open(“openapi.yaml”) as f:
text = f.read()
return quart.Response(text, mimetype=“text/yaml”)def main():
app.run(debug=True, host=“0.0.0.0”, port=5003)if name == “main”:
main()