aboutsummaryrefslogtreecommitdiff
path: root/google/oauth2/id_token.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/oauth2/id_token.py')
-rw-r--r--google/oauth2/id_token.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/google/oauth2/id_token.py b/google/oauth2/id_token.py
index 25492ca..8d0f85a 100644
--- a/google/oauth2/id_token.py
+++ b/google/oauth2/id_token.py
@@ -55,10 +55,12 @@ library like `CacheControl`_ to create a cache-aware
.. _CacheControl: https://cachecontrol.readthedocs.io
"""
-import http.client
import json
import os
+import six
+from six.moves import http_client
+
from google.auth import environment_vars
from google.auth import exceptions
from google.auth import jwt
@@ -95,7 +97,7 @@ def _fetch_certs(request, certs_url):
"""
response = request(certs_url, method="GET")
- if response.status != http.client.OK:
+ if response.status != http_client.OK:
raise exceptions.TransportError(
"Could not fetch certificates at {}".format(certs_url)
)
@@ -240,7 +242,7 @@ def fetch_id_token(request, audience):
"GOOGLE_APPLICATION_CREDENTIALS is not valid service account credentials.",
caught_exc,
)
- raise new_exc from caught_exc
+ six.raise_from(new_exc, caught_exc)
# 2. Try to fetch ID token from metada server if it exists. The code
# works for GAE and Cloud Run metadata server as well.