diff options
Diffstat (limited to 'google/auth/transport/grpc.py')
-rw-r--r-- | google/auth/transport/grpc.py | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/google/auth/transport/grpc.py b/google/auth/transport/grpc.py index 160dc94..c47cb3d 100644 --- a/google/auth/transport/grpc.py +++ b/google/auth/transport/grpc.py @@ -19,6 +19,8 @@ from __future__ import absolute_import import logging import os +import six + from google.auth import environment_vars from google.auth import exceptions from google.auth.transport import _mtls_helper @@ -27,11 +29,13 @@ from google.oauth2 import service_account try: import grpc except ImportError as caught_exc: # pragma: NO COVER - new_exc = ImportError( - "gRPC is not installed, please install the grpcio package " - "to use the gRPC transport." + six.raise_from( + ImportError( + "gRPC is not installed, please install the grpcio package " + "to use the gRPC transport." + ), + caught_exc, ) - raise new_exc from caught_exc _LOGGER = logging.getLogger(__name__) @@ -84,7 +88,7 @@ class AuthMetadataPlugin(grpc.AuthMetadataPlugin): self._request, context.method_name, context.service_url, headers ) - return list(headers.items()) + return list(six.iteritems(headers)) def __call__(self, context, callback): """Passes authorization metadata into the given callback. @@ -333,7 +337,7 @@ class SslCredentials: ) except exceptions.ClientCertError as caught_exc: new_exc = exceptions.MutualTLSChannelError(caught_exc) - raise new_exc from caught_exc + six.raise_from(new_exc, caught_exc) else: self._ssl_credentials = grpc.ssl_channel_credentials() |