import psutil, datetime, logging, os, sys # stdout from logging # Config settings lPyOpenRPASourceFolderPathStr = r"..\Sources" # Path for test pyOpenRPA package # Operations if lPyOpenRPASourceFolderPathStr != "": sys.path.insert(0,os.path.abspath(os.path.join(lPyOpenRPASourceFolderPathStr))) # Path for test pyOpenRPA package from pyOpenRPA.Agent import Agent if __name__ == "__main__": # New init way gSettings = { "OrchestratorDict":{ "IsHTTPSBool": False, # True - if server is secured HTTPS, False - if server is not secured HTTP "HostStr":"127.0.0.1", "PortInt":80, "SuperTokenStr":"", # Access token to Orchestrator }, "O2ADict":{ "IsOnlineBool": True, # Parameter can be changed when program executes "RetryTimeoutSecFloat": 10.0, # Retry interval if some error when connect }, "A2ODict": { "RetryTimeoutSecFloat": 10.0, # Retry interval if some error when connect }, "Logger":logging.getLogger("Agent"), "AgentDict": { # Will be filled automatically "HostNameUpperStr":None, # Machine hostname "UserUpperStr": None, # Username string } } if not os.path.exists("Reports"): os.makedirs("Reports") ########################## # Подготовка логгера Robot ######################### lL = gSettings["Logger"] lL.setLevel(logging.DEBUG) # create the logging file handler mRobotLoggerFH = logging.FileHandler( "Reports\\" + datetime.datetime.now().strftime("%Y_%m_%d") + ".log") mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') mRobotLoggerFH.setFormatter(mRobotLoggerFormatter) # add handler to logger object lL.addHandler(mRobotLoggerFH) ####################Add console output handler = logging.StreamHandler(sys.stdout) handler.setFormatter(mRobotLoggerFormatter) lL.addHandler(handler) ############################################ # Call the orchestrator def Agent.Agent(inGSettings=gSettings)