aboutsummaryrefslogtreecommitdiff
path: root/google/oauth2/credentials.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/oauth2/credentials.py')
-rw-r--r--google/oauth2/credentials.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/google/oauth2/credentials.py b/google/oauth2/credentials.py
index 6d34edf..9b59f8c 100644
--- a/google/oauth2/credentials.py
+++ b/google/oauth2/credentials.py
@@ -35,6 +35,8 @@ from datetime import datetime
import io
import json
+import six
+
from google.auth import _cloud_sdk
from google.auth import _helpers
from google.auth import credentials
@@ -262,7 +264,7 @@ class Credentials(credentials.ReadOnlyScoped, credentials.CredentialsWithQuotaPr
if self._refresh_token is None and self.refresh_handler:
token, expiry = self.refresh_handler(request, scopes=scopes)
# Validate returned data.
- if not isinstance(token, str):
+ if not isinstance(token, six.string_types):
raise exceptions.RefreshError(
"The refresh_handler returned token is not a string."
)
@@ -344,7 +346,7 @@ class Credentials(credentials.ReadOnlyScoped, credentials.CredentialsWithQuotaPr
ValueError: If the info is not in the expected format.
"""
keys_needed = set(("refresh_token", "client_id", "client_secret"))
- missing = keys_needed.difference(info)
+ missing = keys_needed.difference(six.iterkeys(info))
if missing:
raise ValueError(
@@ -364,7 +366,7 @@ class Credentials(credentials.ReadOnlyScoped, credentials.CredentialsWithQuotaPr
# process scopes, which needs to be a seq
if scopes is None and "scopes" in info:
scopes = info.get("scopes")
- if isinstance(scopes, str):
+ if isinstance(scopes, six.string_types):
scopes = scopes.split(" ")
return cls(