فهرست منبع

legge variabile singola

boyska 11 ماه پیش
والد
کامیت
10d20d625e
1فایلهای تغییر یافته به همراه4 افزوده شده و 0 حذف شده
  1. 4 0
      webserver.py

+ 4 - 0
webserver.py

@@ -101,6 +101,10 @@ async def push_message(
 async def get_all_variables() -> AllVariablesModel:
     return settings.variables
 
+@app.get("/variable/{key}")
+async def get_variable(key: str) -> VariableModel:
+    return Response(str(settings.variables[key]), media_type='text/plain')
+
 
 def first_matching(lst: list, condition: Callable[[Any], bool]) -> int:
     """return the index of the first item that matches condition"""