Remove newlines from base64.encodestring output when using long basic auth#30
Remove newlines from base64.encodestring output when using long basic auth#30thelan wants to merge 2 commits intogescheit:masterfrom thelan:master
Conversation
|
Isn't it related to #23? Also, could you please write the scenario with the problem, which this patch solve? |
|
Apparently I didn't remember making the old push request. My bad. I think this would be more efficient to use only one call to When logging with user
|
|
i'll close the old PR for this one. |
|
Test code: #!/usr/bin/env python
from zabbix_api import ZabbixAPI, ZabbixAPISubClass, Already_Exists
import logging
http_login_user='long-zabbix-username'
http_login_password='reallylongpasswordKzSmxbpckS0sJ1tQWQNq7Jvif'
zbx = ZabbixAPI('https://zabbix/api_jsonrpc.php', timeout=600, user=http_login_user, passwd=http_login_password)
zbx.set_log_level(logging.DEBUG)
zbx.login(http_login_user, http_login_password)Output with the patch: Output without patch: (see \n in the Authorization heaer) |
|
Thanks for your contributing! Unfortunately, http-auth had been broken for python3. Can you also make a fix for py3? Problem with py3 in b64encode() function output type. It is bytes. So you need to check python version and depend on it decode b64 result or not. |
|
|
This patch is not needed any more (see #32) |
According to python documentation:
Having extra newline within the header will break the authentication process as the server will read only the first part of the encoded 'user:password'