Cannot login to Zabbix with HTTP Authentication
RedHat93 opened this issue · 2 comments
Hi,
i'm trying to use py-zabbix library to do some task but i cannot login.
I configure my Zabbix Frontend to use "HTTP Authentication" for login.
When i use:
zapi = ZabbixAPI(url='https://zabbixserver.xxx.com/zabbix', user='zbxuser', password='zbxpassword' )
i receive a "401 Unauthorized".
Other library, like https://github.com/lukecyca/pyzabbix, manage correctly the session while logging into a Zabbix that use HTTP Auth.
Can you please implement "session management" also on this library?
Thx a lot in advance,
Andrea
This module doesn't use requests
or any other 3rd-party modules to work. So sessions must be implemented with urllib2. Session in this case just a authentication header.
We can catch server response and base on response header WWW-Authenticate
we can retry request with header Authorization: Basic {{ BASE64 }}
.
Feel free to add it here: https://github.com/adubkov/py-zabbix/blob/master/pyzabbix/api.py#L241