From 6c04e81bdd8dd664e7e6f7bbedf43e784fe32905 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Tue, 6 Sep 2022 00:53:09 +0300 Subject: [PATCH] orc tested --- .../pyOpenRPA/Orchestrator/ServerSettings.py | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py index 892eaad1..afed5a86 100755 --- a/Sources/pyOpenRPA/Orchestrator/ServerSettings.py +++ b/Sources/pyOpenRPA/Orchestrator/ServerSettings.py @@ -399,30 +399,32 @@ def pyOpenRPA_Agent_O2A(inRequest, inGSettings): if lL: lL.exception("pyOpenRPA_Agent_O2A Exception!") lThisAgentDict["ConnectionCountInt"] -= 1 # Connection go to be closed - decrement the connection count -def pyOpenRPA_Debugging_HelperDefList(inRequest, inGSettings): +@app.get(path="/orpa/api/helper-def-list/{inTokenStr}",response_class=JSONResponse,tags=["API"]) +def pyOpenRPA_Debugging_HelperDefList(inRequest:Request, inAuthTokenStr:str = Depends(IdentifyAuthorize), inBodyStr:str = Body("")): # Parse query lResultDict = { "success": True, "results": [] } # Get the path - lPathSplitList = __Orchestrator__.WebRequestParsePath(inRequest=inRequest).split('/') + lPathSplitList = inRequest.url.path.split('/') lQueryStr = None if "HelperDefList" != lPathSplitList[-1] and "" != lPathSplitList[-1]: lQueryStr = lPathSplitList[-1] if lQueryStr != "" and lQueryStr is not None: lDefList = __Orchestrator__.ActivityItemHelperDefList(inDefQueryStr=lQueryStr) for lDefStr in lDefList: lResultDict["results"].append({"name": lDefStr, "value": lDefStr, "text": lDefStr}) - __Orchestrator__.WebRequestResponseSend(inRequest=inRequest, inResponeStr=json.dumps(lResultDict)) + return lResultDict -def pyOpenRPA_Debugging_HelperDefAutofill(inRequest, inGSettings): +@app.get(path="/orpa/api/helper-def-autofill/{inTokenStr}",response_class=JSONResponse,tags=["API"]) +def pyOpenRPA_Debugging_HelperDefAutofill(inRequest:Request, inAuthTokenStr:str = Depends(IdentifyAuthorize), inBodyStr:str = Body("")): # Parse query # Get the path - lPathSplitList = __Orchestrator__.WebRequestParsePath(inRequest=inRequest).split('/') + lPathSplitList = inRequest.url.path.split('/') lQueryStr = None if "HelperDefAutofill" != lPathSplitList[-1] and "" != lPathSplitList[-1]: lQueryStr = lPathSplitList[-1] lResultDict = __Orchestrator__.ActivityItemHelperDefAutofill(inDef = lQueryStr) - __Orchestrator__.WebRequestResponseSend(inRequest=inRequest, inResponeStr=json.dumps(lResultDict)) + return lResultDict # See docs in Agent (pyOpenRPA.Agent.A2O) def pyOpenRPA_Agent_A2O(inRequest, inGSettings): @@ -513,8 +515,8 @@ def SettingsUpdate(): # API #{"Method": "POST", "URL": "/orpa/api/processor-queue-add", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Processor, "ResponseContentType": "application/json"}, #{"Method": "POST", "URL": "/orpa/api/activity-list-execute", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_ActivityListExecute, "ResponseContentType": "application/json"}, - {"Method": "GET", "URL": "/orpa/api/helper-def-list/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefList, "ResponseContentType": "application/json"}, - {"Method": "GET", "URL": "/orpa/api/helper-def-autofill/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefAutofill, "ResponseContentType": "application/json"}, + #{"Method": "GET", "URL": "/orpa/api/helper-def-list/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefList, "ResponseContentType": "application/json"}, + #{"Method": "GET", "URL": "/orpa/api/helper-def-autofill/", "MatchType": "BeginWith","ResponseDefRequestGlobal": pyOpenRPA_Debugging_HelperDefAutofill, "ResponseContentType": "application/json"}, # AGENT {"Method": "POST", "URL": "/orpa/agent/o2a", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_O2A, "ResponseContentType": "application/json"}, {"Method": "POST", "URL": "/orpa/agent/a2o", "MatchType": "Equal","ResponseDefRequestGlobal": pyOpenRPA_Agent_A2O, "ResponseContentType": "application/json"}