Skip to content

Commit

Permalink
Update samples to support latest Google Cloud Python [(#656)](GoogleC…
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Wayne Parrott authored and plamut committed Jul 10, 2020
1 parent b0e307c commit 0eebf5a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 19 deletions.
10 changes: 1 addition & 9 deletions samples/snippets/publisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,7 @@ def list_topics():
"""Lists all Pub/Sub topics in the current project."""
pubsub_client = pubsub.Client()

topics = []
next_page_token = None
while True:
page, next_page_token = pubsub_client.list_topics()
topics.extend(page)
if not next_page_token:
break

for topic in topics:
for topic in pubsub_client.list_topics():
print(topic.name)


Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
google-cloud-pubsub==0.20.0
google-cloud-pubsub==0.21.0
10 changes: 1 addition & 9 deletions samples/snippets/subscriber.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,7 @@ def list_subscriptions(topic_name):
pubsub_client = pubsub.Client()
topic = pubsub_client.topic(topic_name)

subscriptions = []
next_page_token = None
while True:
page, next_page_token = topic.list_subscriptions()
subscriptions.extend(page)
if not next_page_token:
break

for subscription in subscriptions:
for subscription in topic.list_subscriptions():
print(subscription.name)


Expand Down

0 comments on commit 0eebf5a

Please sign in to comment.