aboutsummaryrefslogtreecommitdiff
path: root/google/oauth2/_client_async.py
diff options
context:
space:
mode:
Diffstat (limited to 'google/oauth2/_client_async.py')
-rw-r--r--google/oauth2/_client_async.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/google/oauth2/_client_async.py b/google/oauth2/_client_async.py
index 8849023..cf51211 100644
--- a/google/oauth2/_client_async.py
+++ b/google/oauth2/_client_async.py
@@ -24,9 +24,11 @@ For more information about the token endpoint, see
"""
import datetime
-import http.client
import json
-import urllib
+
+import six
+from six.moves import http_client
+from six.moves import urllib
from google.auth import exceptions
from google.auth import jwt
@@ -83,7 +85,7 @@ async def _token_endpoint_request_no_throw(
response_data = json.loads(response_body)
- if response.status == http.client.OK:
+ if response.status == http_client.OK:
break
else:
error_desc = response_data.get("error_description") or ""
@@ -94,9 +96,9 @@ async def _token_endpoint_request_no_throw(
):
retry += 1
continue
- return response.status == http.client.OK, response_data
+ return response.status == http_client.OK, response_data
- return response.status == http.client.OK, response_data
+ return response.status == http_client.OK, response_data
async def _token_endpoint_request(
@@ -159,7 +161,7 @@ async def jwt_grant(request, token_uri, assertion):
access_token = response_data["access_token"]
except KeyError as caught_exc:
new_exc = exceptions.RefreshError("No access token in response.", response_data)
- raise new_exc from caught_exc
+ six.raise_from(new_exc, caught_exc)
expiry = client._parse_expiry(response_data)
@@ -199,7 +201,7 @@ async def id_token_jwt_grant(request, token_uri, assertion):
id_token = response_data["id_token"]
except KeyError as caught_exc:
new_exc = exceptions.RefreshError("No ID token in response.", response_data)
- raise new_exc from caught_exc
+ six.raise_from(new_exc, caught_exc)
payload = jwt.decode(id_token, verify=False)
expiry = datetime.datetime.utcfromtimestamp(payload["exp"])