Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit59965a4

Browse files
fix: set creds only if transport not provided (#1348)
Co-authored-by: mukund-ananthu <83691193+mukund-ananthu@users.noreply.github.com>
1 parent32d0998 commit59965a4

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

‎google/cloud/pubsub_v1/publisher/client.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,11 +128,15 @@ def __init__(
128128
# Sanity check: Is our goal to use the emulator?
129129
# If so, create a grpc insecure channel with the emulator host
130130
# as the target.
131+
# TODO(https://github.com/googleapis/python-pubsub/issues/1349): Move the emulator
132+
# code below to test files.
131133
ifos.environ.get("PUBSUB_EMULATOR_HOST"):
132134
kwargs["client_options"]= {
133135
"api_endpoint":os.environ.get("PUBSUB_EMULATOR_HOST")
134136
}
135-
kwargs["credentials"]=AnonymousCredentials()
137+
# Configure credentials directly to transport, if provided.
138+
if"transport"notinkwargs:
139+
kwargs["credentials"]=AnonymousCredentials()
136140

137141
# For a transient failure, retry publishing the message infinitely.
138142
self.publisher_options=types.PublisherOptions(*publisher_options)

‎google/cloud/pubsub_v1/subscriber/client.py‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,15 @@ def __init__(
8181
# Sanity check: Is our goal to use the emulator?
8282
# If so, create a grpc insecure channel with the emulator host
8383
# as the target.
84+
# TODO(https://github.com/googleapis/python-pubsub/issues/1349): Move the emulator
85+
# code below to test files.
8486
ifos.environ.get("PUBSUB_EMULATOR_HOST"):
8587
kwargs["client_options"]= {
8688
"api_endpoint":os.environ.get("PUBSUB_EMULATOR_HOST")
8789
}
88-
kwargs["credentials"]=AnonymousCredentials()
90+
# Configure credentials directly to transport, if provided.
91+
if"transport"notinkwargs:
92+
kwargs["credentials"]=AnonymousCredentials()
8993

9094
# Instantiate the underlying GAPIC client.
9195
super().__init__(**kwargs)

‎owlbot.py‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
ifcount<len(clients_to_patch):
100100
raiseException(err_msg)
101101

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp