lib: better print with debug_xmlrpc

Fixes: https://pagure.io/koji/issue/2597
This commit is contained in:
Tomas Kopecek 2020-12-14 14:55:25 +01:00
parent 48d4f0db25
commit 9d64bafed6

View file

@ -2702,8 +2702,11 @@ class ClientSession(object):
_val = callopts[_key]
if _key == 'data':
if six.PY3 and isinstance(_val, bytes):
# convert to hex-string
_val = '0x' + _val.hex()
try:
_val = _val.decode()
except UnicodeDecodeError:
# convert to hex-string
_val = '0x' + _val.hex()
if len(_val) > 1024:
_val = _val[:1024] + '...'
self.logger.debug("%s: %r" % (_key, _val))