@@ -29,7 +29,8 @@ def list_topics(project_id):
2929 # [START pubsub_list_topics]
3030 from google .cloud import pubsub_v1
3131
32- # TODO project_id = "Your Google Cloud Project ID"
32+ # TODO(developer)
33+ # project_id = "your-project-id"
3334
3435 publisher = pubsub_v1 .PublisherClient ()
3536 project_path = publisher .project_path (project_id )
@@ -45,8 +46,9 @@ def create_topic(project_id, topic_name):
4546 # [START pubsub_create_topic]
4647 from google .cloud import pubsub_v1
4748
48- # TODO project_id = "Your Google Cloud Project ID"
49- # TODO topic_name = "Your Pub/Sub topic name"
49+ # TODO(developer)
50+ # project_id = "your-project-id"
51+ # topic_name = "your-topic-id"
5052
5153 publisher = pubsub_v1 .PublisherClient ()
5254 topic_path = publisher .topic_path (project_id , topic_name )
@@ -63,8 +65,9 @@ def delete_topic(project_id, topic_name):
6365 # [START pubsub_delete_topic]
6466 from google .cloud import pubsub_v1
6567
66- # TODO project_id = "Your Google Cloud Project ID"
67- # TODO topic_name = "Your Pub/Sub topic name"
68+ # TODO(developer)
69+ # project_id = "your-project-id"
70+ # topic_name = "your-topic-id"
6871
6972 publisher = pubsub_v1 .PublisherClient ()
7073 topic_path = publisher .topic_path (project_id , topic_name )
@@ -81,8 +84,9 @@ def publish_messages(project_id, topic_name):
8184 # [START pubsub_publish]
8285 from google .cloud import pubsub_v1
8386
84- # TODO project_id = "Your Google Cloud Project ID"
85- # TODO topic_name = "Your Pub/Sub topic name"
87+ # TODO(developer)
88+ # project_id = "your-project-id"
89+ # topic_name = "your-topic-id"
8690
8791 publisher = pubsub_v1 .PublisherClient ()
8892 # The `topic_path` method creates a fully qualified identifier
@@ -108,8 +112,9 @@ def publish_messages_with_custom_attributes(project_id, topic_name):
108112 # [START pubsub_publish_custom_attributes]
109113 from google .cloud import pubsub_v1
110114
111- # TODO project_id = "Your Google Cloud Project ID"
112- # TODO topic_name = "Your Pub/Sub topic name"
115+ # TODO(developer)
116+ # project_id = "your-project-id"
117+ # topic_name = "your-topic-id"
113118
114119 publisher = pubsub_v1 .PublisherClient ()
115120 topic_path = publisher .topic_path (project_id , topic_name )
@@ -135,8 +140,9 @@ def publish_messages_with_error_handler(project_id, topic_name):
135140
136141 from google .cloud import pubsub_v1
137142
138- # TODO project_id = "Your Google Cloud Project ID"
139- # TODO topic_name = "Your Pub/Sub topic name"
143+ # TODO(developer)
144+ # project_id = "your-project-id"
145+ # topic_name = "your-topic-id"
140146
141147 publisher = pubsub_v1 .PublisherClient ()
142148 topic_path = publisher .topic_path (project_id , topic_name )
@@ -177,8 +183,9 @@ def publish_messages_with_batch_settings(project_id, topic_name):
177183 # [START pubsub_publisher_batch_settings]
178184 from google .cloud import pubsub_v1
179185
180- # TODO project_id = "Your Google Cloud Project ID"
181- # TODO topic_name = "Your Pub/Sub topic name"
186+ # TODO(developer)
187+ # project_id = "your-project-id"
188+ # topic_name = "your-topic-id"
182189
183190 # Configure the batch to publish as soon as there is ten messages,
184191 # one kilobyte of data, or one second has passed.
@@ -212,8 +219,9 @@ def publish_messages_with_retry_settings(project_id, topic_name):
212219 # [START pubsub_publisher_retry_settings]
213220 from google .cloud import pubsub_v1
214221
215- # TODO project_id = "Your Google Cloud Project ID"
216- # TODO topic_name = "Your Pub/Sub topic name"
222+ # TODO(developer)
223+ # project_id = "your-project-id"
224+ # topic_name = "your-topic-id"
217225
218226 # Configure the retry settings. Defaults will be overwritten.
219227 retry_settings = {
@@ -267,8 +275,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
267275
268276if __name__ == "__main__" :
269277 parser = argparse .ArgumentParser (
270- description = __doc__ ,
271- formatter_class = argparse .RawDescriptionHelpFormatter ,
278+ description = __doc__ , formatter_class = argparse .RawDescriptionHelpFormatter ,
272279 )
273280 parser .add_argument ("project_id" , help = "Your Google Cloud project ID" )
274281
@@ -281,9 +288,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
281288 delete_parser = subparsers .add_parser ("delete" , help = delete_topic .__doc__ )
282289 delete_parser .add_argument ("topic_name" )
283290
284- publish_parser = subparsers .add_parser (
285- "publish" , help = publish_messages .__doc__
286- )
291+ publish_parser = subparsers .add_parser ("publish" , help = publish_messages .__doc__ )
287292 publish_parser .add_argument ("topic_name" )
288293
289294 publish_with_custom_attributes_parser = subparsers .add_parser (
@@ -293,8 +298,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
293298 publish_with_custom_attributes_parser .add_argument ("topic_name" )
294299
295300 publish_with_error_handler_parser = subparsers .add_parser (
296- "publish-with-error-handler" ,
297- help = publish_messages_with_error_handler .__doc__ ,
301+ "publish-with-error-handler" , help = publish_messages_with_error_handler .__doc__ ,
298302 )
299303 publish_with_error_handler_parser .add_argument ("topic_name" )
300304
@@ -321,9 +325,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
321325 elif args .command == "publish" :
322326 publish_messages (args .project_id , args .topic_name )
323327 elif args .command == "publish-with-custom-attributes" :
324- publish_messages_with_custom_attributes (
325- args .project_id , args .topic_name
326- )
328+ publish_messages_with_custom_attributes (args .project_id , args .topic_name )
327329 elif args .command == "publish-with-error-handler" :
328330 publish_messages_with_error_handler (args .project_id , args .topic_name )
329331 elif args .command == "publish-with-batch-settings" :
0 commit comments