You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
106 lines
4.4 KiB
106 lines
4.4 KiB
5 years ago
|
#Robot RDPActive settings
|
||
5 years ago
|
from pyOpenRPA.Robot import OrchestratorConnector
|
||
|
import os
|
||
|
import logging
|
||
|
import datetime
|
||
|
#Definitions
|
||
|
lOrchestratorHost="localhost"
|
||
|
lOrchestratorPort=8081
|
||
|
lOrchestratorProtocol="http"
|
||
|
lOrchestratorAuthToken="1992-04-03-0643-ru-b4ff-openrpa52zzz"
|
||
5 years ago
|
def Settings():
|
||
|
mDict = {
|
||
|
"RDPList":
|
||
|
[
|
||
|
{
|
||
|
"Host": "77.77.22.22", # Host address
|
||
|
"Port": "7777", # RDP Port
|
||
|
"Login": "test", # Login
|
||
|
"Password": "test", # Password
|
||
|
"Screen": {
|
||
|
"Width": 1680, #Width of the remote desktop in pixels
|
||
|
"Height": 1050, #Height of the remote desktop in pixels
|
||
|
# "640x480" or "1680x1050" or "FullScreen". If Resolution not exists set full screen
|
||
|
"FlagUseAllMonitors": False, # True or False
|
||
|
"DepthBit": "32" # "32" or "24" or "16" or "15"
|
||
|
},
|
||
5 years ago
|
"SessionHex":"", # Hex is created when robot runs
|
||
|
"FlagSessionIsActive": False
|
||
|
}
|
||
|
],
|
||
|
"Logger": logging.getLogger("RobotRDPActive"),
|
||
|
"OrchestratorToRobotStorage": {
|
||
|
|
||
|
},
|
||
|
"OrchestratorToRobotResetStorage": {
|
||
|
"SafeTurnOff":False #Control from orchestrator to safety turn off robot
|
||
|
},
|
||
|
"OrchestratorConnector": {
|
||
|
#Fill below
|
||
|
},
|
||
5 years ago
|
"OrchestratorConnectorTerminateAll":OrchestratorConnector.IntervalTermimateAll #Call this function when program must be shutted down (to kill threads from OrchestratorConnector)
|
||
5 years ago
|
}
|
||
|
######################
|
||
|
#OrchestratorConnector
|
||
|
######################
|
||
|
mDict["OrchestratorConnector"]={
|
||
|
"IntervalDataSendAsync": [
|
||
|
{
|
||
|
"Interval": 2.7,
|
||
|
"RobotStorage": mDict,
|
||
|
"RobotStorageKey": "RDPList",
|
||
|
"OrchestratorKeyList": ["Storage", "RobotRDPActive","RobotToOrchestratorStorage","RDPList"],
|
||
|
"OrchestratorProtocol": lOrchestratorProtocol,
|
||
|
"OrchestratorHost": lOrchestratorHost,
|
||
|
"OrchestratorPort": lOrchestratorPort,
|
||
|
"OrchestratorAuthToken": lOrchestratorAuthToken
|
||
|
}
|
||
|
],
|
||
|
"IntervalDataReceiveResetAsync": [
|
||
|
{
|
||
|
"Interval": 3.3,
|
||
|
"RobotStorage": mDict,
|
||
|
"RobotStorageKey": "OrchestratorToRobotResetStorage",
|
||
|
"RobotResetValue": {"SafeTurnOff":False},
|
||
|
"OrchestratorKeyList": ["Storage", "RobotRDPActive","OrchestratorToRobotResetStorage"],
|
||
|
"OrchestratorProtocol": lOrchestratorProtocol,
|
||
|
"OrchestratorHost": lOrchestratorHost,
|
||
|
"OrchestratorPort": lOrchestratorPort,
|
||
|
"OrchestratorAuthToken": lOrchestratorAuthToken
|
||
|
}
|
||
|
],
|
||
|
"IntervalDataReceiveAsync": [
|
||
|
{
|
||
|
"Interval": 3.6,
|
||
|
"RobotStorage": mDict,
|
||
|
"RobotStorageKey": "OrchestratorToRobotStorage",
|
||
|
"OrchestratorKeyList": ["Storage", "RobotRDPActive","OrchestratorToRobotStorage"],
|
||
|
"OrchestratorProtocol": lOrchestratorProtocol,
|
||
|
"OrchestratorHost": lOrchestratorHost,
|
||
|
"OrchestratorPort": lOrchestratorPort,
|
||
|
"OrchestratorAuthToken": lOrchestratorAuthToken
|
||
5 years ago
|
}
|
||
|
]
|
||
|
}
|
||
5 years ago
|
#Turn off many warnings from orchestrator connector logger
|
||
|
OrchestratorConnector.LoggerSetLevelError()
|
||
|
#Run OrchestratorConnector initialization
|
||
|
OrchestratorConnector.ConfigurationInit(mDict["OrchestratorConnector"])
|
||
|
#########################
|
||
|
#Создать файл логирования
|
||
|
# add filemode="w" to overwrite
|
||
|
if not os.path.exists("Reports"):
|
||
|
os.makedirs("Reports")
|
||
|
##########################
|
||
|
#Подготовка логгера Robot
|
||
|
#########################
|
||
|
mRobotLogger=mDict["Logger"]
|
||
|
mRobotLogger.setLevel(logging.INFO)
|
||
|
# create the logging file handler
|
||
|
mRobotLoggerFH = logging.FileHandler("Reports\ReportRobotRDPActive_"+datetime.datetime.now().strftime("%Y_%m_%d")+".log")
|
||
|
mRobotLoggerFormatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
|
||
|
mRobotLoggerFH.setFormatter(mRobotLoggerFormatter)
|
||
|
# add handler to logger object
|
||
|
mRobotLogger.addHandler(mRobotLoggerFH)
|
||
|
############################################
|
||
5 years ago
|
return mDict
|