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

Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8f7511a

Browse files
committed
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