# $Id$
+# $URL$
import safexmlrpc
-import hmac, sha
+import hmac
+try:
+ from hashlib import sha1 as sha
+except ImportError:
+ import sha
import logger
class PLCAPI:
session => SessionAuth
To authenticate using the Boot Manager authentication method, or
- the new session-based method.
+ the new session-based method, respectively.
"""
def __init__(self, uri, cacert, auth, timeout = 90, **kwds):
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("plcapi: failed in plcapi.check_authentication")
+ return authstatus
def add_auth(self, function):