Skip to content
This repository was archived by the owner on Mar 13, 2022. It is now read-only.

Commit e62a87a

Browse files
committed
Handle bytes string for Python 3
1 parent 6ff4cb7 commit e62a87a

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

config/kube_config.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,14 @@ def _load_oid_token(self):
241241
if len(parts) != 3: # Not a valid JWT
242242
return None
243243

244-
jwt_attributes = json.loads(
245-
base64.b64decode(parts[1])
246-
)
244+
if PY3:
245+
jwt_attributes = json.loads(
246+
base64.b64decode(parts[1]).decode('utf-8')
247+
)
248+
else:
249+
jwt_attributes = json.loads(
250+
base64.b64decode(parts[1])
251+
)
247252

248253
expire = jwt_attributes.get('exp')
249254

0 commit comments

Comments
 (0)