From 8f056e024e6e32e40e8cca14c91a091d28e4f752 Mon Sep 17 00:00:00 2001 From: Ivan Maslov Date: Mon, 12 Apr 2021 18:45:51 +0300 Subject: [PATCH] Debug upgrade --- Sources/pyOpenRPA/Agent/O2A.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Sources/pyOpenRPA/Agent/O2A.py b/Sources/pyOpenRPA/Agent/O2A.py index 68aa09c8..d3ed4153 100644 --- a/Sources/pyOpenRPA/Agent/O2A.py +++ b/Sources/pyOpenRPA/Agent/O2A.py @@ -1,4 +1,4 @@ -import requests, time +import requests, time, json # O2A - Data flow Orchestrator to Agent # f"{lProtocolStr}://{lHostStr}:{lPortInt}/pyOpenRPA/Agent/O2A" @@ -19,6 +19,7 @@ def O2A_Loop(inGSettings): lActivityLastGUIDStr = "" # Init empty ActivityLastGUIDStr while inGSettings["O2ADict"]["IsOnlineBool"]: # Send request to the orchestrator server + lRequestBody = None try: lProtocolStr= "https" if inGSettings["OrchestratorDict"]["IsHTTPSBool"] else "http" lHostStr = inGSettings["OrchestratorDict"]["HostStr"] @@ -30,6 +31,7 @@ def O2A_Loop(inGSettings): if lL: lL.warning(f"Agent can not connect to Orchestrator. Below the response from the orchestrator:{lResponse}") time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"]) else: + lRequestBody = lResponse.text lQueueItem = lResponse.json() # Try to get JSON # Append QUEUE item in ProcessorDict > ActivityList lActivityLastGUIDStr = lQueueItem["GUIDStr"] @@ -43,4 +45,8 @@ def O2A_Loop(inGSettings): time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"]) except ConnectionResetError as e: if lL: lL.error(f"O2A Connection error - orchestrator is not available. Sleep for {inGSettings['A2ODict']['RetryTimeoutSecFloat']} s.") + time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"]) + except json.decoder.JSONDecodeError as e: + if lL: lL.error( + f"See body of the recieved content from the Orchestrator: {lRequestBody}") time.sleep(inGSettings["O2ADict"]["RetryTimeoutSecFloat"]) \ No newline at end of file