aboutsummaryrefslogtreecommitdiffstats
path: root/gui/api/__init__.py
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2018-06-18 16:00:16 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2018-06-18 16:00:16 +0200
commit9df483045b5622af8902c07b54c7f985e12b1671 (patch)
tree33ea77312758ddc19911e211a41d1eddb85d6177 /gui/api/__init__.py
parentb76ebdb856b20a8078c6386bc20e79aa0d8db741 (diff)
downloaddabmod-9df483045b5622af8902c07b54c7f985e12b1671.tar.gz
dabmod-9df483045b5622af8902c07b54c7f985e12b1671.tar.bz2
dabmod-9df483045b5622af8902c07b54c7f985e12b1671.zip
Add DPD page to web gui
Diffstat (limited to 'gui/api/__init__.py')
-rwxr-xr-xgui/api/__init__.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/gui/api/__init__.py b/gui/api/__init__.py
index 1bc95a6..959dedc 100755
--- a/gui/api/__init__.py
+++ b/gui/api/__init__.py
@@ -31,8 +31,9 @@ import io
import datetime
class API:
- def __init__(self, mod_rc):
+ def __init__(self, mod_rc, dpd):
self.mod_rc = mod_rc
+ self.dpd = dpd
@cherrypy.expose
def index(self):
@@ -60,3 +61,13 @@ class API:
cherrypy.response.headers["Content-Type"] = "application/json"
cherrypy.response.status = 400
return json.dumps("POST only").encode()
+
+ @cherrypy.expose
+ def trigger_capture(self, **kwargs):
+ if cherrypy.request.method == 'POST':
+ cherrypy.response.headers["Content-Type"] = "text/plain"
+ return self.dpd.capture_samples()
+ else:
+ cherrypy.response.headers["Content-Type"] = "text/plain"
+ cherrypy.response.status = 400
+ return "POST only"