Skip to content

Commit

Permalink
chore: clean up region tags (#207)
Browse files Browse the repository at this point in the history
  • Loading branch information
anguillanneuf committed Sep 25, 2020
1 parent f791d8f commit 1193cd1
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 16 deletions.
4 changes: 2 additions & 2 deletions samples/snippets/publisher.py
Expand Up @@ -134,7 +134,7 @@ def publish_messages_with_custom_attributes(project_id, topic_id):


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

Expand Down Expand Up @@ -173,7 +173,7 @@ def callback(f):
time.sleep(5)

print("Published message with error handler.")
# [END pubsub_publish_messages_error_handler]
# [END pubsub_publish_with_error_handler]


def publish_messages_with_batch_settings(project_id, topic_id):
Expand Down
7 changes: 0 additions & 7 deletions samples/snippets/quickstart/pub.py
Expand Up @@ -14,15 +14,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START pubsub_quickstart_pub_all]
import argparse
import time

# [START pubsub_quickstart_pub_deps]
from google.cloud import pubsub_v1

# [END pubsub_quickstart_pub_deps]


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

def pub(project_id, topic_id):
"""Publishes a message to a Pub/Sub topic."""
# [START pubsub_quickstart_pub_client]
# Initialize a Publisher client.
client = pubsub_v1.PublisherClient()
# [END pubsub_quickstart_pub_client]
# Create a fully qualified identifier in the form of
# `projects/{project_id}/topics/{topic_id}`
topic_path = client.topic_path(project_id, topic_id)
Expand Down Expand Up @@ -83,4 +77,3 @@ def pub(project_id, topic_id):
args = parser.parse_args()

pub(args.project_id, args.topic_id)
# [END pubsub_quickstart_pub_all]
7 changes: 0 additions & 7 deletions samples/snippets/quickstart/sub.py
Expand Up @@ -14,21 +14,15 @@
# See the License for the specific language governing permissions and
# limitations under the License.

# [START pubsub_quickstart_sub_all]
import argparse

# [START pubsub_quickstart_sub_deps]
from google.cloud import pubsub_v1

# [END pubsub_quickstart_sub_deps]


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

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

0 comments on commit 1193cd1

Please sign in to comment.