plc = PLCAPI(config.plc_api_uri, config.cacert, session, timeout=iperiod/2)
#check auth
+ logger.log("Checking Auth.")
while plc.check_authentication() != True:
try:
plc.update_session()
except:
logger.log("Retry Failed. Waiting")
time.sleep(iperiod)
+ logger.log("Authentication Succeeded!")
while True:
def check_authentication(self):
- # just a simple call to check authentication
- return self.AuthCheck(self)
+ authstatus = False
+ if self.key or self.session:
+ try:
+ authstatus = self.AuthCheck()
+ except:
+ logger.log_exc()
+ return authstatus
def add_auth(self, function):