Skip to content

Commit

Permalink
fix: pass updated keyword args to Publisher/Subscriber client in goog…
Browse files Browse the repository at this point in the history
…le/pubsub #161 (#164)

…le/pubsub

---------

Co-authored-by: David Ankin <daveankin@gmail.com>
  • Loading branch information
Mohsin-Ul-Islam and alexanderankin committed Mar 30, 2024
1 parent 8fb4bcc commit 8addc11
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions modules/google/testcontainers/google/pubsub.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ def _get_client(self, cls: type, **kwargs) -> dict:
return cls(**kwargs)

def get_publisher_client(self, **kwargs) -> pubsub.PublisherClient:
from google.auth import credentials

kwargs["client_options"] = {"api_endpoint": self.get_pubsub_emulator_host()}
kwargs["credentials"] = credentials.AnonymousCredentials()
return self._get_client(pubsub.PublisherClient, **kwargs)

def get_subscriber_client(self, **kwargs) -> pubsub.SubscriberClient:
from google.auth import credentials

kwargs["client_options"] = {"api_endpoint": self.get_pubsub_emulator_host()}
kwargs["credentials"] = credentials.AnonymousCredentials()
return self._get_client(pubsub.SubscriberClient, **kwargs)

0 comments on commit 8addc11

Please sign in to comment.