8000 Fix for 'TypeError: string argument without an encoding' (regressing … · sonlinux/client_python@8f7511a · GitHub
[go: up one dir, main page]

Skip to content

Commit 8f7511a

Browse files
committ 8000 ed
Fix for 'TypeError: string argument without an encoding' (regressing in python3).
1 parent 1ba7c2e commit 8f7511a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

prometheus_client/exposition.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ def handle():
145145
'''Handler that implements HTTP Basic Auth.
146146
'''
147147
if username is not None and password is not None:
148-
auth_value = "{0}:{1}".format(username, password)
149-
auth_token = base64.b64encode(auth_value)
148+
auth_value = bytes('{0}:{1}'.format(username, password), 'utf8')
149+
auth_token = str(base64.b64encode(auth_value), 'utf8')
150150
auth_header = "Basic {0}".format(auth_token)
151151
headers.append(['Authorization', auth_header])
152152
default_handler(url, method, timeout, headers, data)()

0 commit comments

Comments
 (0)
0