Skip to content

Commit ca7414d

Browse files
authored
Merge pull request #110 from maxgrechnev/hotfix/check-auth-method
Fixed support of user.checkAuthentication method
2 parents 0aba01e + 1dd367e commit ca7414d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

pyzabbix/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ def login(self, user='', password=''):
7171
else:
7272
self.auth = self.user.login(user=user, password=password)
7373

74+
def check_authentication(self):
75+
"""Convenience method for calling user.checkAuthentication of the current session"""
76+
return self.user.checkAuthentication(sessionid=self.auth)
77+
7478
def confimport(self, confformat='', source='', rules=''):
7579
"""Alias for configuration.import because it clashes with
7680
Python's import reserved keyword
@@ -95,8 +99,8 @@ def do_request(self, method, params=None):
9599
'id': self.id,
96100
}
97101

98-
# We don't have to pass the auth token if asking for the apiinfo.version
99-
if self.auth and method != 'apiinfo.version':
102+
# We don't have to pass the auth token if asking for the apiinfo.version or user.checkAuthentication
103+
if self.auth and method != 'apiinfo.version' and method != 'user.checkAuthentication':
100104
request_json['auth'] = self.auth
101105

102106
logger.debug("Sending: %s", json.dumps(request_json,

0 commit comments

Comments
 (0)