diff --git a/main.py b/main.py index ab990e1ecaf..5b62071bb0b 100644 --- a/main.py +++ b/main.py @@ -1,13 +1,18 @@ import requests -import html +import urllib.parse +import json def define_env(env): - "Hook function" + "Hook function" - @env.macro - def workflowDemo(workflow_endpoint): - r = requests.get(url = workflow_endpoint) - workflow_json = r.content.decode("utf-8") - print(workflow_json) - return f"
" + @env.macro + def workflowDemo(workflow_endpoint): + r = requests.get(url = workflow_endpoint) + wf_data = r.json() + workflow_json = { + "nodes": wf_data['workflow']['nodes'], + "connections": wf_data['workflow']['connections'] + } + encoded_workflow_json = urllib.parse.quote(json.dumps(workflow_json)) + return f"
"