From 80484f0d669761cfe3434b6f50f6cf7804fec0f0 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Sep 25 2019 13:54:57 +0000 Subject: Use bytes for debug string Fixes: https://pagure.io/koji/issue/1656 --- diff --git a/koji/__init__.py b/koji/__init__.py index 9ab8377..f25a001 100644 --- a/koji/__init__.py +++ b/koji/__init__.py @@ -2535,8 +2535,12 @@ class ClientSession(object): self.logger.debug("url: %s" % handler) for _key in callopts: _val = callopts[_key] - if _key == 'data' and len(_val) > 1024: - _val = _val[:1024] + '...' + if _key == 'data': + if six.PY3 and isinstance(_val, bytes): + # convert to hex-string + _val = '0x' + _val.hex() + if len(_val) > 1024: + _val = _val[:1024] + '...' self.logger.debug("%s: %r" % (_key, _val)) with warnings.catch_warnings(): warnings.simplefilter("ignore")