Skip to content

Commit 8addc11

Browse files
fix: pass updated keyword args to Publisher/Subscriber client in google/pubsub #161 (#164)
…le/pubsub --------- Co-authored-by: David Ankin <[email protected]>
1 parent 8fb4bcc commit 8addc11

File tree

1 file changed

+8
-0
lines changed
  • modules/google/testcontainers/google

1 file changed

+8
-0
lines changed

modules/google/testcontainers/google/pubsub.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,15 @@ def _get_client(self, cls: type, **kwargs) -> dict:
5656
return cls(**kwargs)
5757

5858
def get_publisher_client(self, **kwargs) -> pubsub.PublisherClient:
59+
from google.auth import credentials
60+
61+
kwargs["client_options"] = {"api_endpoint": self.get_pubsub_emulator_host()}
62+
kwargs["credentials"] = credentials.AnonymousCredentials()
5963
return self._get_client(pubsub.PublisherClient, **kwargs)
6064

6165
def get_subscriber_client(self, **kwargs) -> pubsub.SubscriberClient:
66+
from google.auth import credentials
67+
68+
kwargs["client_options"] = {"api_endpoint": self.get_pubsub_emulator_host()}
69+
kwargs["credentials"] = credentials.AnonymousCredentials()
6270
return self._get_client(pubsub.SubscriberClient, **kwargs)

0 commit comments

Comments
 (0)