Skip to content

Commit 1193cd1

Browse files
chore: clean up region tags (googleapis#207)
1 parent f791d8f commit 1193cd1

3 files changed

Lines changed: 2 additions & 16 deletions

File tree

samples/snippets/publisher.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ def publish_messages_with_custom_attributes(project_id, topic_id):
134134

135135

136136
def publish_messages_with_error_handler(project_id, topic_id):
137-
# [START pubsub_publish_messages_error_handler]
137+
# [START pubsub_publish_with_error_handler]
138138
"""Publishes multiple messages to a Pub/Sub topic with an error handler."""
139139
import time
140140

@@ -173,7 +173,7 @@ def callback(f):
173173
time.sleep(5)
174174

175175
print("Published message with error handler.")
176-
# [END pubsub_publish_messages_error_handler]
176+
# [END pubsub_publish_with_error_handler]
177177

178178

179179
def publish_messages_with_batch_settings(project_id, topic_id):

samples/snippets/quickstart/pub.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,11 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# [START pubsub_quickstart_pub_all]
1817
import argparse
1918
import time
2019

21-
# [START pubsub_quickstart_pub_deps]
2220
from google.cloud import pubsub_v1
2321

24-
# [END pubsub_quickstart_pub_deps]
25-
2622

2723
def get_callback(api_future, data, ref):
2824
"""Wrap message data in the context of the callback function."""
@@ -48,10 +44,8 @@ def callback(api_future):
4844

4945
def pub(project_id, topic_id):
5046
"""Publishes a message to a Pub/Sub topic."""
51-
# [START pubsub_quickstart_pub_client]
5247
# Initialize a Publisher client.
5348
client = pubsub_v1.PublisherClient()
54-
# [END pubsub_quickstart_pub_client]
5549
# Create a fully qualified identifier in the form of
5650
# `projects/{project_id}/topics/{topic_id}`
5751
topic_path = client.topic_path(project_id, topic_id)
@@ -83,4 +77,3 @@ def pub(project_id, topic_id):
8377
args = parser.parse_args()
8478

8579
pub(args.project_id, args.topic_id)
86-
# [END pubsub_quickstart_pub_all]

samples/snippets/quickstart/sub.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,15 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17-
# [START pubsub_quickstart_sub_all]
1817
import argparse
1918

20-
# [START pubsub_quickstart_sub_deps]
2119
from google.cloud import pubsub_v1
2220

23-
# [END pubsub_quickstart_sub_deps]
24-
2521

2622
def sub(project_id, subscription_id):
2723
"""Receives messages from a Pub/Sub subscription."""
28-
# [START pubsub_quickstart_sub_client]
2924
# Initialize a Subscriber client
3025
subscriber_client = pubsub_v1.SubscriberClient()
31-
# [END pubsub_quickstart_sub_client]
3226
# Create a fully qualified identifier in the form of
3327
# `projects/{project_id}/subscriptions/{subscription_id}`
3428
subscription_path = subscriber_client.subscription_path(project_id, subscription_id)
@@ -66,4 +60,3 @@ def callback(message):
6660
args = parser.parse_args()
6761

6862
sub(args.project_id, args.subscription_id)
69-
# [END pubsub_quickstart_sub_all]

0 commit comments

Comments
 (0)