@@ -75,11 +75,22 @@ def main(client, customer_id, audience_id):
7575 #
7676 # Create the headlines.
7777 headline_asset_resource_names = _create_multiple_text_assets (
78- client , customer_id , ["Travel" , "Travel Reviews" , "Book travel" ,],
78+ client ,
79+ customer_id ,
80+ [
81+ "Travel" ,
82+ "Travel Reviews" ,
83+ "Book travel" ,
84+ ],
7985 )
8086 # Create the descriptions.
8187 description_asset_resource_names = _create_multiple_text_assets (
82- client , customer_id , ["Take to the air!" , "Fly to the sky!" ,],
88+ client ,
89+ customer_id ,
90+ [
91+ "Take to the air!" ,
92+ "Fly to the sky!" ,
93+ ],
8394 )
8495
8596 # The below methods create and return MutateOperations that we later
@@ -90,13 +101,18 @@ def main(client, customer_id, audience_id):
90101 # successfully or fail entirely, leaving no orphaned entities. See:
91102 # https://developers.google.com/google-ads/api/docs/mutating/overview
92103 campaign_budget_operation = _create_campaign_budget_operation (
93- client , customer_id ,
104+ client ,
105+ customer_id ,
94106 )
95- performance_max_campaign_operation = _create_performance_max_campaign_operation (
96- client , customer_id ,
107+ performance_max_campaign_operation = (
108+ _create_performance_max_campaign_operation (
109+ client ,
110+ customer_id ,
111+ )
97112 )
98113 campaign_criterion_operations = _create_campaign_criterion_operations (
99- client , customer_id ,
114+ client ,
115+ customer_id ,
100116 )
101117 asset_group_operations = _create_asset_group_operation (
102118 client ,
@@ -135,7 +151,8 @@ def main(client, customer_id, audience_id):
135151
136152# [START add_performance_max_campaign_2]
137153def _create_campaign_budget_operation (
138- client , customer_id ,
154+ client ,
155+ customer_id ,
139156):
140157 """Creates a MutateOperation that creates a new CampaignBudget.
141158
@@ -173,7 +190,8 @@ def _create_campaign_budget_operation(
173190
174191# [START add_performance_max_campaign_3]
175192def _create_performance_max_campaign_operation (
176- client , customer_id ,
193+ client ,
194+ customer_id ,
177195):
178196 """Creates a MutateOperation that creates a new Performance Max campaign.
179197
@@ -242,7 +260,8 @@ def _create_performance_max_campaign_operation(
242260
243261# [START add_performance_max_campaign_4]
244262def _create_campaign_criterion_operations (
245- client , customer_id ,
263+ client ,
264+ customer_id ,
246265):
247266 """Creates a list of MutateOperations that create new campaign criteria.
248267
@@ -273,8 +292,8 @@ def _create_campaign_criterion_operations(
273292 campaign_criterion .campaign = campaign_service .campaign_path (
274293 customer_id , _PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
275294 )
276- campaign_criterion .location .geo_target_constant = geo_target_constant_service . geo_target_constant_path (
277- "1023191"
295+ campaign_criterion .location .geo_target_constant = (
296+ geo_target_constant_service . geo_target_constant_path ( "1023191" )
278297 )
279298 campaign_criterion .negative = False
280299 operations .append (mutate_operation )
@@ -285,8 +304,8 @@ def _create_campaign_criterion_operations(
285304 campaign_criterion .campaign = campaign_service .campaign_path (
286305 customer_id , _PERFORMANCE_MAX_CAMPAIGN_TEMPORARY_ID
287306 )
288- campaign_criterion .location .geo_target_constant = geo_target_constant_service . geo_target_constant_path (
289- "1022762"
307+ campaign_criterion .location .geo_target_constant = (
308+ geo_target_constant_service . geo_target_constant_path ( "1022762" )
290309 )
291310 campaign_criterion .negative = True
292311 operations .append (mutate_operation )
@@ -300,8 +319,8 @@ def _create_campaign_criterion_operations(
300319 # Set the language.
301320 # For a list of all language codes, see:
302321 # https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
303- campaign_criterion .language .language_constant = googleads_service . language_constant_path (
304- "1000"
322+ campaign_criterion .language .language_constant = (
323+ googleads_service . language_constant_path ( "1000" )
305324 ) # English
306325 operations .append (mutate_operation )
307326
@@ -335,7 +354,8 @@ def _create_multiple_text_assets(client, customer_id, texts):
335354
336355 # Send the operations in a single Mutate request.
337356 response = googleads_service .mutate (
338- customer_id = customer_id , mutate_operations = operations ,
357+ customer_id = customer_id ,
358+ mutate_operations = operations ,
339359 )
340360 asset_resource_names = []
341361 for result in response .mutate_operation_responses :
@@ -383,7 +403,8 @@ def _create_asset_group_operation(
383403 asset_group .final_mobile_urls .append ("http://www.example.com" )
384404 asset_group .status = client .enums .AssetGroupStatusEnum .PAUSED
385405 asset_group .resource_name = asset_group_service .asset_group_path (
386- customer_id , _ASSET_GROUP_TEMPORARY_ID ,
406+ customer_id ,
407+ _ASSET_GROUP_TEMPORARY_ID ,
387408 )
388409 operations .append (mutate_operation )
389410
@@ -407,7 +428,8 @@ def _create_asset_group_operation(
407428 asset_group_asset = mutate_operation .asset_group_asset_operation .create
408429 asset_group_asset .field_type = client .enums .AssetFieldTypeEnum .HEADLINE
409430 asset_group_asset .asset_group = asset_group_service .asset_group_path (
410- customer_id , _ASSET_GROUP_TEMPORARY_ID ,
431+ customer_id ,
432+ _ASSET_GROUP_TEMPORARY_ID ,
411433 )
412434 asset_group_asset .asset = resource_name
413435 operations .append (mutate_operation )
@@ -420,7 +442,8 @@ def _create_asset_group_operation(
420442 client .enums .AssetFieldTypeEnum .DESCRIPTION
421443 )
422444 asset_group_asset .asset_group = asset_group_service .asset_group_path (
423- customer_id , _ASSET_GROUP_TEMPORARY_ID ,
445+ customer_id ,
446+ _ASSET_GROUP_TEMPORARY_ID ,
424447 )
425448 asset_group_asset .asset = resource_name
426449 operations .append (mutate_operation )
@@ -508,7 +531,8 @@ def _create_and_link_text_asset(client, customer_id, text, field_type):
508531 asset_group_asset = mutate_operation .asset_group_asset_operation .create
509532 asset_group_asset .field_type = field_type
510533 asset_group_asset .asset_group = asset_group_service .asset_group_path (
511- customer_id , _ASSET_GROUP_TEMPORARY_ID ,
534+ customer_id ,
535+ _ASSET_GROUP_TEMPORARY_ID ,
512536 )
513537 asset_group_asset .asset = asset_service .asset_path (
514538 customer_id , next_temp_id
@@ -558,7 +582,8 @@ def _create_and_link_image_asset(
558582 asset_group_asset = mutate_operation .asset_group_asset_operation .create
559583 asset_group_asset .field_type = field_type
560584 asset_group_asset .asset_group = asset_group_service .asset_group_path (
561- customer_id , _ASSET_GROUP_TEMPORARY_ID ,
585+ customer_id ,
586+ _ASSET_GROUP_TEMPORARY_ID ,
562587 )
563588 asset_group_asset .asset = asset_service .asset_path (
564589 customer_id , next_temp_id
@@ -659,7 +684,10 @@ def _create_asset_group_signal_operation(client, customer_id, audience_id):
659684 help = "The Google Ads customer ID." ,
660685 )
661686 parser .add_argument (
662- "-a" , "--audience_id" , type = str , help = "The ID of an audience." ,
687+ "-a" ,
688+ "--audience_id" ,
689+ type = str ,
690+ help = "The ID of an audience." ,
663691 )
664692
665693 args = parser .parse_args ()
0 commit comments