From 55ebe4b1a1855f6368574016b294009914ef1968 Mon Sep 17 00:00:00 2001 From: Sijun Liu Date: Wed, 6 May 2020 16:58:36 -0700 Subject: [PATCH] fix: support string type response.data --- google/auth/impersonated_credentials.py | 1 + 1 file changed, 1 insertion(+) diff --git a/google/auth/impersonated_credentials.py b/google/auth/impersonated_credentials.py index c2351e7f7..84df484a4 100644 --- a/google/auth/impersonated_credentials.py +++ b/google/auth/impersonated_credentials.py @@ -88,6 +88,7 @@ def _make_iam_token_request(request, principal, headers, body): response = request(url=iam_endpoint, method="POST", headers=headers, body=body) + # support both string and bytes type response.data response_body = ( response.data.decode("utf-8") if hasattr(response.data, "decode")