Explorar el Código

legge variabile singola

boyska hace 10 meses
padre
commit
10d20d625e
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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"""