Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion google/cloud/pubsub_v1/publisher/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,15 @@ def __init__(
# Sanity check: Is our goal to use the emulator?
# If so, create a grpc insecure channel with the emulator host
# as the target.
# TODO(https://github.com/googleapis/python-pubsub/issues/1349): Move the emulator
# code below to test files.
if os.environ.get("PUBSUB_EMULATOR_HOST"):
kwargs["client_options"] = {
"api_endpoint": os.environ.get("PUBSUB_EMULATOR_HOST")
}
kwargs["credentials"] = AnonymousCredentials()
# Configure credentials directly to transport, if provided.
if "transport" not in kwargs:
kwargs["credentials"] = AnonymousCredentials()

# For a transient failure, retry publishing the message infinitely.
self.publisher_options = types.PublisherOptions(*publisher_options)
Expand Down
6 changes: 5 additions & 1 deletion google/cloud/pubsub_v1/subscriber/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,15 @@ def __init__(
# Sanity check: Is our goal to use the emulator?
# If so, create a grpc insecure channel with the emulator host
# as the target.
# TODO(https://github.com/googleapis/python-pubsub/issues/1349): Move the emulator
# code below to test files.
if os.environ.get("PUBSUB_EMULATOR_HOST"):
kwargs["client_options"] = {
"api_endpoint": os.environ.get("PUBSUB_EMULATOR_HOST")
}
kwargs["credentials"] = AnonymousCredentials()
# Configure credentials directly to transport, if provided.
if "transport" not in kwargs:
kwargs["credentials"] = AnonymousCredentials()

# Instantiate the underlying GAPIC client.
super().__init__(**kwargs)
Expand Down
2 changes: 2 additions & 0 deletions owlbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
if count < len(clients_to_patch):
raise Exception(err_msg)

# TODO(https://github.com/googleapis/python-pubsub/issues/1349): Move the emulator
# code below to test files.
count = s.replace(
clients_to_patch,
r"# initialize with the provided callable or the passed in class",
Expand Down
Loading