From 8eed8e16019510dc8b20fb6b009d61a7ac532d26 Mon Sep 17 00:00:00 2001 From: HemangChothani <50404902+HemangChothani@users.noreply.github.com> Date: Mon, 21 Dec 2020 16:39:25 -0500 Subject: [PATCH] fix: pass anonymous credentials for emulator (#250) --- google/cloud/pubsub_v1/publisher/client.py | 2 ++ google/cloud/pubsub_v1/subscriber/client.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/google/cloud/pubsub_v1/publisher/client.py b/google/cloud/pubsub_v1/publisher/client.py index 6a9418e69..81cfdea10 100644 --- a/google/cloud/pubsub_v1/publisher/client.py +++ b/google/cloud/pubsub_v1/publisher/client.py @@ -26,6 +26,7 @@ from google.api_core import gapic_v1 from google.api_core import grpc_helpers +from google.auth.credentials import AnonymousCredentials from google.oauth2 import service_account from google.cloud.pubsub_v1 import _gapic @@ -129,6 +130,7 @@ def __init__(self, batch_settings=(), publisher_options=(), **kwargs): kwargs["channel"] = grpc.insecure_channel( target=os.environ.get("PUBSUB_EMULATOR_HOST") ) + kwargs["credentials"] = AnonymousCredentials() # The GAPIC client has mTLS logic to determine the api endpoint and the # ssl credentials to use. Here we create a GAPIC client to help compute the diff --git a/google/cloud/pubsub_v1/subscriber/client.py b/google/cloud/pubsub_v1/subscriber/client.py index 937be1552..a1f93e52e 100644 --- a/google/cloud/pubsub_v1/subscriber/client.py +++ b/google/cloud/pubsub_v1/subscriber/client.py @@ -20,6 +20,7 @@ import grpc from google.api_core import grpc_helpers +from google.auth.credentials import AnonymousCredentials from google.oauth2 import service_account from google.cloud.pubsub_v1 import _gapic @@ -80,6 +81,7 @@ def __init__(self, **kwargs): kwargs["channel"] = grpc.insecure_channel( target=os.environ.get("PUBSUB_EMULATOR_HOST") ) + kwargs["credentials"] = AnonymousCredentials() # The GAPIC client has mTLS logic to determine the api endpoint and the # ssl credentials to use. Here we create a GAPIC client to help compute the