summaryrefslogtreecommitdiffstats
path: root/python/gui/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/gui/api.py')
-rwxr-xr-xpython/gui/api.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/python/gui/api.py b/python/gui/api.py
index c0effde..f9e0ad0 100755
--- a/python/gui/api.py
+++ b/python/gui/api.py
@@ -80,8 +80,18 @@ class API:
return send_error(str(e))
return send_ok()
else:
- cherrypy.response.status = 400
- return send_error("POST only")
+ if all(p in kwargs for p in ('controllable', 'param')):
+ try:
+ return send_ok(self.mod_rc.get_param_value(kwargs['controllable'], kwargs['param']))
+ except IOError as e:
+ cherrypy.response.status = 503
+ return send_error(str(e))
+ except ValueError as e:
+ cherrypy.response.status = 503
+ return send_error(str(e))
+ else:
+ cherrypy.response.status = 400
+ return send_error("missing 'controllable' or 'param' GET parameters")
def _wrap_dpd(self, method, data=None):
try:
@@ -89,12 +99,12 @@ class API:
return send_ok(reply)
except ValueError as e:
cherrypy.response.status = 503
- return send_error("YAML-RPC call error: {}".format(e))
+ return send_error("DPDCE remote procedure call error: {}".format(e))
except TimeoutError as e:
cherrypy.response.status = 503
- return send_error("YAML-RPC timeout: {}".format(e))
+ return send_error("DPDCE remote procedure call timed out")
cherrypy.response.status = 500
- return send_error("YAML-RPC unknown error")
+ return send_error("Unknown DPDCE remote procedure error error")
@cherrypy.expose
@cherrypy.tools.json_out()