mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-10 01:17:42 +01:00
Update http_config.py
Allow to query one config parameter
This commit is contained in:
parent
884f8b86f4
commit
cfff093673
1 changed files with 6 additions and 6 deletions
|
@ -2,7 +2,7 @@ from aiohttp import web
|
||||||
from cbpi.api import *
|
from cbpi.api import *
|
||||||
|
|
||||||
from cbpi.utils import json_dumps
|
from cbpi.utils import json_dumps
|
||||||
|
import logging
|
||||||
|
|
||||||
|
|
||||||
class ConfigHttpEndpoints:
|
class ConfigHttpEndpoints:
|
||||||
|
@ -58,7 +58,7 @@ class ConfigHttpEndpoints:
|
||||||
"""
|
"""
|
||||||
return web.json_response(self.controller.cache, dumps=json_dumps)
|
return web.json_response(self.controller.cache, dumps=json_dumps)
|
||||||
|
|
||||||
@request_mapping(path="/{name}/", auth_required=False)
|
@request_mapping(path="/{name}/", method="POST", auth_required=False)
|
||||||
async def http_paramter(self, request) -> web.Response:
|
async def http_paramter(self, request) -> web.Response:
|
||||||
"""
|
"""
|
||||||
---
|
---
|
||||||
|
@ -76,7 +76,7 @@ class ConfigHttpEndpoints:
|
||||||
description: successful operation
|
description: successful operation
|
||||||
"""
|
"""
|
||||||
name = request.match_info['name']
|
name = request.match_info['name']
|
||||||
if name not in self.cache:
|
# if name not in self.cache:
|
||||||
raise CBPiException("Parameter %s not found" % name)
|
# raise CBPiException("Parameter %s not found" % name)
|
||||||
|
data = self.controller.get(name)
|
||||||
return web.json_response(self.cache.get(name), dumps=json_dumps)
|
return web.json_response(self.controller.get(name), dumps=json_dumps)
|
||||||
|
|
Loading…
Reference in a new issue