diff options
Diffstat (limited to 'query')
-rw-r--r-- | query/__init__.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/query/__init__.py b/query/__init__.py index dc3339c..40c645b 100644 --- a/query/__init__.py +++ b/query/__init__.py @@ -26,6 +26,17 @@ class MyHandler(BaseHTTPServer.BaseHTTPRequestHandler): args = server_registry[s.server] path = o.path + if path == "/flow.png": + s.send_response(200) + s.send_header("Content-type", "image/png") + s.end_headers() + dot = args['top_block'].query(json.dumps(dict(path='/flows.dot'))) + import subprocess + p = subprocess.Popen(args=["dot", "-T", "png"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + (stdout, stderr) = p.communicate(input=dot) + s.wfile.write(stdout) + return + #handle json requests if path.endswith('.json'): s.send_response(200) |