@@ -29,7 +29,8 @@ def list_topics(project_id):
29
29
# [START pubsub_list_topics]
30
30
from google .cloud import pubsub_v1
31
31
32
- # TODO project_id = "Your Google Cloud Project ID"
32
+ # TODO(developer)
33
+ # project_id = "your-project-id"
33
34
34
35
publisher = pubsub_v1 .PublisherClient ()
35
36
project_path = publisher .project_path (project_id )
@@ -45,8 +46,9 @@ def create_topic(project_id, topic_name):
45
46
# [START pubsub_create_topic]
46
47
from google .cloud import pubsub_v1
47
48
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"
50
52
51
53
publisher = pubsub_v1 .PublisherClient ()
52
54
topic_path = publisher .topic_path (project_id , topic_name )
@@ -63,8 +65,9 @@ def delete_topic(project_id, topic_name):
63
65
# [START pubsub_delete_topic]
64
66
from google .cloud import pubsub_v1
65
67
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"
68
71
69
72
publisher = pubsub_v1 .PublisherClient ()
70
73
topic_path = publisher .topic_path (project_id , topic_name )
@@ -81,8 +84,9 @@ def publish_messages(project_id, topic_name):
81
84
# [START pubsub_publish]
82
85
from google .cloud import pubsub_v1
83
86
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"
86
90
87
91
publisher = pubsub_v1 .PublisherClient ()
88
92
# The `topic_path` method creates a fully qualified identifier
@@ -108,8 +112,9 @@ def publish_messages_with_custom_attributes(project_id, topic_name):
108
112
# [START pubsub_publish_custom_attributes]
109
113
from google .cloud import pubsub_v1
110
114
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"
113
118
114
119
publisher = pubsub_v1 .PublisherClient ()
115
120
topic_path = publisher .topic_path (project_id , topic_name )
@@ -135,8 +140,9 @@ def publish_messages_with_error_handler(project_id, topic_name):
135
140
136
141
from google .cloud import pubsub_v1
137
142
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"
140
146
141
147
publisher = pubsub_v1 .PublisherClient ()
142
148
topic_path = publisher .topic_path (project_id , topic_name )
@@ -177,8 +183,9 @@ def publish_messages_with_batch_settings(project_id, topic_name):
177
183
# [START pubsub_publisher_batch_settings]
178
184
from google .cloud import pubsub_v1
179
185
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"
182
189
183
190
# Configure the batch to publish as soon as there is ten messages,
184
191
# one kilobyte of data, or one second has passed.
@@ -212,8 +219,9 @@ def publish_messages_with_retry_settings(project_id, topic_name):
212
219
# [START pubsub_publisher_retry_settings]
213
220
from google .cloud import pubsub_v1
214
221
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"
217
225
218
226
# Configure the retry settings. Defaults will be overwritten.
219
227
retry_settings = {
@@ -267,8 +275,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
267
275
268
276
if __name__ == "__main__" :
269
277
parser = argparse .ArgumentParser (
270
- description = __doc__ ,
271
- formatter_class = argparse .RawDescriptionHelpFormatter ,
278
+ description = __doc__ , formatter_class = argparse .RawDescriptionHelpFormatter ,
272
279
)
273
280
parser .add_argument ("project_id" , help = "Your Google Cloud project ID" )
274
281
@@ -281,9 +288,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
281
288
delete_parser = subparsers .add_parser ("delete" , help = delete_topic .__doc__ )
282
289
delete_parser .add_argument ("topic_name" )
283
290
284
- publish_parser = subparsers .add_parser (
285
- "publish" , help = publish_messages .__doc__
286
- )
291
+ publish_parser = subparsers .add_parser ("publish" , help = publish_messages .__doc__ )
287
292
publish_parser .add_argument ("topic_name" )
288
293
289
294
publish_with_custom_attributes_parser = subparsers .add_parser (
@@ -293,8 +298,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
293
298
publish_with_custom_attributes_parser .add_argument ("topic_name" )
294
299
295
300
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__ ,
298
302
)
299
303
publish_with_error_handler_parser .add_argument ("topic_name" )
300
304
@@ -321,9 +325,7 @@ def publish_messages_with_retry_settings(project_id, topic_name):
321
325
elif args .command == "publish" :
322
326
publish_messages (args .project_id , args .topic_name )
323
327
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 )
327
329
elif args .command == "publish-with-error-handler" :
328
330
publish_messages_with_error_handler (args .project_id , args .topic_name )
329
331
elif args .command == "publish-with-batch-settings" :
0 commit comments