|
@@ -103,7 +103,11 @@ async def get_all_variables() -> AllVariablesModel:
|
|
|
|
|
|
@app.get("/variables/{key}")
|
|
|
async def get_variable(key: str) -> VariableModel:
|
|
|
- return Response(str(settings.variables[key]), media_type='text/plain')
|
|
|
+ try:
|
|
|
+ value = settings.variables[key]
|
|
|
+ except KeyError:
|
|
|
+ raise HTTPException(status_code=404, detail="Variable not found")
|
|
|
+ return Response(str(value), media_type='text/plain')
|
|
|
|
|
|
|
|
|
def first_matching(lst: list, condition: Callable[[Any], bool]) -> int:
|