Matrix bridge working and effectively pushing messages
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -22,5 +22,7 @@ def executeRequest(action, outputs, resolved):
|
||||
# session.cookies.set(
|
||||
# sessioncookies[cookie_name] = response[cookie_key],
|
||||
|
||||
|
||||
print(request)
|
||||
#print(response.status_code)
|
||||
#print(response.text)
|
||||
return response, outputs
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
def buildKey(key, outputs, resolved):
|
||||
value = key["keyvalue"]
|
||||
|
||||
if isinstance(value, dict) and "output" in value:
|
||||
value = outputs[value["output"]]
|
||||
if isinstance(value, dict):
|
||||
if "output" in value:
|
||||
value = outputs[value["output"]]
|
||||
|
||||
elif "resolved" in value:
|
||||
value = resolved[value["resolved"]]
|
||||
|
||||
if "prefix" in key["keyvalue"]:
|
||||
value = key["keyvalue"]["prefix"] + str(value)
|
||||
|
||||
return {
|
||||
key["keytitle"]: value,
|
||||
|
||||
@@ -7,5 +7,5 @@ def buildObject(keys, outputs, resolved):
|
||||
object.update(
|
||||
buildKey(key, outputs, resolved),
|
||||
)
|
||||
|
||||
|
||||
return object
|
||||
|
||||
+30
-6
@@ -1,4 +1,22 @@
|
||||
def buildPath(path, outputs, resolved):
|
||||
result = ""
|
||||
|
||||
for part in path:
|
||||
if isinstance(part, dict):
|
||||
if "resolved" in part:
|
||||
value = resolved[part["resolved"]]
|
||||
elif "output" in part:
|
||||
value = outputs[part["output"]]
|
||||
else:
|
||||
raise ValueError(f"Unsupported path component: {part}")
|
||||
|
||||
result += str(value)
|
||||
else:
|
||||
result += str(part)
|
||||
|
||||
return result
|
||||
|
||||
def buildPath3(path, outputs, resolved):
|
||||
if isinstance(path, str):
|
||||
return path
|
||||
|
||||
@@ -6,18 +24,24 @@ def buildPath(path, outputs, resolved):
|
||||
|
||||
for part in path:
|
||||
if isinstance(part, dict):
|
||||
if "resolved" in part:
|
||||
#for key, val in part.items():
|
||||
#value = outputs[part["output"]][part["keys"]]
|
||||
value = resolved["path"]
|
||||
value = resolved[part["resolved"]]
|
||||
#print("DEBUG path", value)
|
||||
|
||||
|
||||
#for key in part.get("keys", []):
|
||||
#value = value[key]
|
||||
if "suffix" in part:
|
||||
suffix = part["suffix"]
|
||||
|
||||
result += str(value)
|
||||
else:
|
||||
result += part
|
||||
#print(result)
|
||||
if value != None:
|
||||
result += str(value)
|
||||
if suffix != None:
|
||||
result += str(suffix)
|
||||
else:
|
||||
result += part
|
||||
print(result)
|
||||
return result
|
||||
|
||||
def buildPath2(path, outputs, resolved):
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
from .object import buildObject
|
||||
from .path import buildPath
|
||||
import os
|
||||
|
||||
def buildRequest(definition, outputs, resolved):
|
||||
path = buildPath(definition.path, outputs, resolved)
|
||||
@@ -20,6 +21,9 @@ def buildRequest(definition, outputs, resolved):
|
||||
|
||||
if isinstance(value, dict) and "output" in header_value:
|
||||
value = outputs[value["output"]]
|
||||
if isinstance(value, dict) and "os" in header_value:
|
||||
#value = os.environ[definition.headers[header_name]["os"]]
|
||||
value = os.environ["AS_TOKEN"]
|
||||
|
||||
if isinstance(header_value, dict) and "prefix" in header_value:
|
||||
value = header_value["prefix"] + value
|
||||
|
||||
Reference in New Issue
Block a user