Working list selection filter
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,18 @@
|
||||
def buildPath(path, outputs):
|
||||
if isinstance(path, str):
|
||||
return path
|
||||
|
||||
result = ""
|
||||
|
||||
for part in path:
|
||||
if isinstance(part, dict):
|
||||
value = outputs[part["output"]]
|
||||
|
||||
for key in part.get("keys", []):
|
||||
value = value[key]
|
||||
|
||||
result += str(value)
|
||||
else:
|
||||
result += part
|
||||
|
||||
return result
|
||||
@@ -1,9 +1,12 @@
|
||||
from .object import buildObject
|
||||
from .path import buildPath
|
||||
|
||||
def buildRequest(definition, outputs):
|
||||
path = buildPath(definition.path, outputs)
|
||||
|
||||
request = {
|
||||
"method": definition.method,
|
||||
"path": definition.path,
|
||||
"path": path,
|
||||
}
|
||||
|
||||
if hasattr(definition, "keys"):
|
||||
@@ -25,4 +28,6 @@ def buildRequest(definition, outputs):
|
||||
|
||||
request["headers"] = headers
|
||||
|
||||
print(path)
|
||||
|
||||
return request, outputs
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#from . import outputs
|
||||
#from . import managefailure
|
||||
#from . import savedata
|
||||
from .select import buildSelect, buildSelect2
|
||||
from .outputs import buildOutput
|
||||
from .savedata import buildSave, loadSave
|
||||
from .logs import buildLog
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,6 +1,6 @@
|
||||
import logging
|
||||
|
||||
def buildLog (action, outputs):
|
||||
def buildLog (action, outputs, response):
|
||||
#if response.status_code == 200:
|
||||
#print(f"{action.name} successful")
|
||||
try:
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
def buildOutput(response, action, outputs):
|
||||
|
||||
def buildOutput(response, action, outputs):#, select_data):
|
||||
#if select_data != "not applied":
|
||||
#response_data = select_data
|
||||
#else:
|
||||
#response_data = response.json()
|
||||
|
||||
response_data = response.json()
|
||||
response_objects = [response_data]
|
||||
|
||||
@@ -17,3 +21,5 @@ def buildOutput(response, action, outputs):
|
||||
|
||||
|
||||
return outputs
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,21 @@
|
||||
from core.runtime import buildOutput, buildSave, buildLog
|
||||
from core.runtime import buildSelect, buildSelect2, buildOutput, buildSave, buildLog
|
||||
|
||||
#select_data = {}
|
||||
|
||||
def buildRuntimeAttr(action, outputs, response):
|
||||
#select_data = {}
|
||||
#response_data = response.json()
|
||||
|
||||
#if hasattr(action, "select"):
|
||||
#select_data, action, outputs = buildSelect(response, action, outputs)
|
||||
#else:
|
||||
#select_data = "not applied"
|
||||
#print("BEFORE buildOutput:", type(outputs))
|
||||
if hasattr(action, "outputs"):
|
||||
outputs = buildOutput(response, action, outputs)
|
||||
|
||||
outputs = buildOutput(response, action, outputs)#, select_data)
|
||||
|
||||
if hasattr(action, "select"):
|
||||
select_data, action, outputs = buildSelect2(action, outputs)
|
||||
#print("AFTER buildOutput:", type(outputs))
|
||||
#print("DEBUG buildSave")
|
||||
#print("outputs type:", type(outputs))
|
||||
@@ -15,7 +26,7 @@ def buildRuntimeAttr(action, outputs, response):
|
||||
buildSave(outputs, action)
|
||||
|
||||
if hasattr(action, "prints"):
|
||||
buildLog(action, outputs)
|
||||
buildLog(action, outputs, response)
|
||||
|
||||
#if hasattr(action, "conversion"):
|
||||
#conversions = action.conversion.items()
|
||||
@@ -26,5 +37,5 @@ def buildRuntimeAttr(action, outputs, response):
|
||||
|
||||
if action.showstatus is True and response.status_code == 200:
|
||||
print(f"{action.name} successful")
|
||||
|
||||
|
||||
return outputs, response
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
def buildSelect(response, action, outputs):
|
||||
#if hasattr(action, "select"):
|
||||
|
||||
response_data = response.json()
|
||||
#selection = action.select
|
||||
#print(response_data)
|
||||
|
||||
select_data ={}
|
||||
for item, index in action.select.items():
|
||||
select_data[item] = response_data[item][index]
|
||||
|
||||
print(select_data)
|
||||
|
||||
#if select_data == None:
|
||||
# selection = "not applied"
|
||||
#else:
|
||||
selection = select_data
|
||||
|
||||
return selection, action, outputs
|
||||
|
||||
def buildSelect2(action, outputs):
|
||||
#print(outputs)
|
||||
select_data = []
|
||||
target = outputs[action.select["source"]]
|
||||
selectmethod = action.select["selectmethod"]
|
||||
targetkey = action.select["key"]
|
||||
targetvalue = action.select["value"]
|
||||
#for item in target:
|
||||
for item in target:
|
||||
#print (item)
|
||||
for key, value in item.items():
|
||||
if selectmethod == "exclude":
|
||||
if targetkey == key and item[key] != targetvalue:
|
||||
select_data.append(item)
|
||||
#print(item)
|
||||
if selectmethod == "include":
|
||||
if targetkey == key and item[key] == targetvalue:
|
||||
select_data.append(item)
|
||||
#print(item)
|
||||
print(select_data)
|
||||
return select_data, action, outputs
|
||||
#for item in outputs[output_name]:
|
||||
#for key, value in action.select.include.items():
|
||||
#if key in item and item[key] == value:
|
||||
#select_data.append(item)
|
||||
@@ -1 +1 @@
|
||||
from . import login, getcsrf, refresh_tokens, checkavailable, setavailable, setunavailable, setnotset
|
||||
from . import login, getcsrf, refresh_tokens, checkavailable, setavailable, setunavailable, setnotset, getmessage
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,63 @@
|
||||
import os
|
||||
|
||||
name = "Get message"
|
||||
|
||||
kind = "action"
|
||||
|
||||
#id = "getmessage"
|
||||
|
||||
showstatus = True
|
||||
|
||||
#skipstep = {
|
||||
# "checkavailable": "validTo >= 3600"
|
||||
#}
|
||||
|
||||
#availabletime = int(os.environ.get("AVAILABLE_DURATION",3))
|
||||
|
||||
#duration = availabletime - 1
|
||||
|
||||
#keys = [
|
||||
# {
|
||||
# "keytitle": "option",
|
||||
# "keyvalue": 1,
|
||||
# },
|
||||
# {
|
||||
# "keytitle": "duration",
|
||||
# "keyvalue": duration,
|
||||
# },
|
||||
#]
|
||||
|
||||
method = "GET"
|
||||
|
||||
#messageid = 49971192
|
||||
|
||||
#path = f"https://rentmasseur.com/api/v1/mailbox/{messageid}"
|
||||
#path = [
|
||||
# "https://rentmasseur.com/api/v1/mailbox/",
|
||||
# {"output": "[messageid][0].id"}
|
||||
#]
|
||||
|
||||
path = [
|
||||
"https://rentmasseur.com/api/v1/mailbox/",
|
||||
{
|
||||
"output": "messageid",
|
||||
"keys": [0, "id"]
|
||||
}
|
||||
]
|
||||
|
||||
#path = os.path.join(baseurl.messageid)
|
||||
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"output": "access_token",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
}
|
||||
|
||||
outputs = {
|
||||
"conversation": "messages"
|
||||
}
|
||||
|
||||
#prints = {
|
||||
# "message": "messages"
|
||||
#}
|
||||
@@ -0,0 +1,52 @@
|
||||
name = "Get message list"
|
||||
|
||||
kind = "action"
|
||||
|
||||
id = "getmessagelist"
|
||||
|
||||
showstatus = True
|
||||
|
||||
#skipstep = {
|
||||
# "checkavailable": "validTo >= 3600"
|
||||
#}
|
||||
|
||||
#availabletime = int(os.environ.get("AVAILABLE_DURATION",3))
|
||||
|
||||
#duration = availabletime - 1
|
||||
|
||||
#keys = [
|
||||
# {
|
||||
# "keytitle": "option",
|
||||
# "keyvalue": 1,
|
||||
# },
|
||||
# {
|
||||
# "keytitle": "duration",
|
||||
# "keyvalue": duration,
|
||||
# },
|
||||
#]
|
||||
|
||||
method = "GET"
|
||||
|
||||
#path = "https://rentmasseur.com/api/v1/mailbox?page=1&folder=1&sort=1"
|
||||
path = "https://rentmasseur.com/api/v1/mailbox"
|
||||
headers = {
|
||||
"Authorization": {
|
||||
"output": "access_token",
|
||||
"prefix": "Bearer ",
|
||||
},
|
||||
}
|
||||
|
||||
select = {
|
||||
"source": "emails",
|
||||
"selectmethod": "exclude",
|
||||
"key": "unread",
|
||||
"value": 0,
|
||||
}
|
||||
|
||||
outputs = {
|
||||
"emails": "emails"
|
||||
}
|
||||
|
||||
#prints = {
|
||||
# "messageid": "id"
|
||||
#}
|
||||
@@ -1,2 +1,2 @@
|
||||
from . import login, checkavailable, setavailable
|
||||
from . import login, checkavailable, setavailable, pullmessagelist
|
||||
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,26 @@
|
||||
from plugins.rmass.actions import pullmessagelist, refresh_tokens, getmessage
|
||||
|
||||
name = "Get Message List"
|
||||
|
||||
kind = "operation"
|
||||
|
||||
actions = [
|
||||
refresh_tokens,
|
||||
pullmessagelist,
|
||||
#getmessage,
|
||||
#setavailable,
|
||||
]
|
||||
|
||||
#sleeptime = 10
|
||||
|
||||
#skipstep = {
|
||||
# setavailable: {
|
||||
# "output": "validTo",
|
||||
# "operator": ">=",
|
||||
# "value": 3600,
|
||||
# }
|
||||
#}
|
||||
|
||||
#role = "activate"
|
||||
|
||||
#sleeptime = 180
|
||||
@@ -0,0 +1,28 @@
|
||||
import time
|
||||
from plugins import rmass
|
||||
from core.execution.operation import buildOperation
|
||||
|
||||
outputs = buildOperation(rmass.operations.pullmessagelist)
|
||||
|
||||
#print(outputs)
|
||||
user_list = []
|
||||
for item in outputs["message_list"]:
|
||||
sender = item["userCard"]
|
||||
user_list.append(sender["id"])
|
||||
print(user_list)
|
||||
|
||||
conversations = []
|
||||
for item in outputs["message_list"]:
|
||||
conversation = item["id"]
|
||||
conversations.append(conversation)
|
||||
|
||||
print(conversations)
|
||||
#for messageid in user_list
|
||||
#outputs = buildOperation(rmass.operations.getmessage)
|
||||
#id_list = []
|
||||
#for user in user_list
|
||||
# id_list.append
|
||||
# print
|
||||
|
||||
|
||||
#ime.sleep(rmass.operations.setavailable.sleeptime)
|
||||
@@ -0,0 +1,38 @@
|
||||
import time
|
||||
from plugins import rmass
|
||||
from core.execution.operation import buildOperation
|
||||
from core.execution.action import buildAction
|
||||
#from plugins.rmass.actions.getmessage import getmessageaction
|
||||
|
||||
outputs = buildOperation(rmass.operations.pullmessagelist)
|
||||
|
||||
#print(outputs)
|
||||
#print(messageid)
|
||||
#user_list = []
|
||||
#for item in outputs["message_list"]:
|
||||
# sender = item["userCard"]
|
||||
# user_list.append(sender["id"])
|
||||
#print(user_list)
|
||||
|
||||
#conversations = []
|
||||
#for item in outputs["message_list"]:
|
||||
# conversation = item["id"]
|
||||
# conversations.append(conversation)
|
||||
|
||||
#print(conversations)
|
||||
|
||||
#for messageid in conversations:
|
||||
#outputs = buildAction(rmass.actions.getmessage, outputs)
|
||||
|
||||
#print(outputs)
|
||||
|
||||
|
||||
#for messageid in user_list
|
||||
#outputs = buildOperation(rmass.operations.getmessage)
|
||||
#id_list = []
|
||||
#for user in user_list
|
||||
# id_list.append
|
||||
# print
|
||||
|
||||
|
||||
#ime.sleep(rmass.operations.setavailable.sleeptime)
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTE2NzQzMzAsIm5iZiI6MTc5MTY3NDE1MCwic3ViIjoiMjM4MzAyIiwidXNlcm5hbWUiOiJYeHhvdGlxIiwidXNlclR5cGUiOjEsInN0YWdlTmFtZSI6Ilh4eG90aXEiLCJhcHByb3ZlZCI6MSwibG9jYXRpb25JZCI6NDcyLCJzZWFyY2hDaXR5IjoiYXRsYW50YSIsImNvdW50cnlTaG9ydCI6IlVTIiwic2Vzc2lvbkNvdW50cnlDb250aW5lbnQiOiJOQSIsImlzRnJvemVuIjowLCJsb2NhdGlvbkxhYmVsIjoiQXRsYW50YSwgR0EiLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZXVyLmNvbSIsImlhdCI6MTc5MTY3NDIxMH0.HcqR4crgZkqdaSKpY3EiC8aejvlgQppKZbV_El8MeCPzoRSHssJcDtj5dmDXjP3VhjseIbgPvCqDxKC2jb3Qdg", "refresh_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJleHAiOjE3OTQyNjYyMTAsIm5iZiI6MTc5MTY3NDE1MCwianRpIjoiZTJRY3FUYnNBSjRpZWNSQ0JEWUdXY2pvYkxDREkrS05mRUwzQUU1OEk3az0iLCJpc3MiOiJodHRwczovL3JlbnRtYXNzZX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