Skip to content

Commit

Permalink
fix login for zabbix >=5.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ghormoon committed Oct 5, 2022
1 parent b05d608 commit f05b3e5
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion zabbix/zabbix_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ def login(self, user='', password='', save=True, api_token=None):
hashed_pw_string = "md5(" + hashlib.md5(l_password.encode('utf-8')).hexdigest() + ")"
self.debug(logging.DEBUG, "Trying to login with %s:%s" %
(repr(l_user), repr(hashed_pw_string)))
obj = self.json_obj('user.login', {'user': l_user, 'password': l_password}, auth=False)
if self.api_version() >= '5.4':
obj = self.json_obj('user.login', {'username': l_user, 'password': l_password}, auth=False)
else:
obj = self.json_obj('user.login', {'user': l_user, 'password': l_password}, auth=False)
result = self.do_request(obj)
self.auth = result['result']

Expand Down

0 comments on commit f05b3e5

Please sign in to comment.