@@ -64,7 +64,7 @@ def main(client, customer_id, campaign_id, ad_group_id):
6464 # Associate the page feed with the campaign.
6565 update_campaign_dsa_setting (client , customer_id , campaign_id ,
6666 feed_details )
67- ad_group_service = client .get_service ('AdGroupService' , version = 'v2 ' )
67+ ad_group_service = client .get_service ('AdGroupService' , version = 'v3 ' )
6868 ad_group_resource_name = ad_group_service .ad_group_path (customer_id ,
6969 ad_group_id )
7070
@@ -94,14 +94,14 @@ def create_feed(client, customer_id):
9494 A FeedDetails instance with information about the newly created feed.
9595 """
9696 # Retrieve a new feed operation object.
97- feed_operation = client .get_type ('FeedOperation' , version = 'v2 ' )
97+ feed_operation = client .get_type ('FeedOperation' , version = 'v3 ' )
9898 # Create a new feed.
9999 feed = feed_operation .create
100100 feed .name .value = 'DSA Feed #{}' .format (uuid .uuid4 ())
101- feed .origin = client .get_type ('FeedOriginEnum' , version = 'v2 ' ).USER
101+ feed .origin = client .get_type ('FeedOriginEnum' , version = 'v3 ' ).USER
102102
103103 feed_attribute_type_enum = client .get_type ('FeedAttributeTypeEnum' ,
104- version = 'v2 ' )
104+ version = 'v3 ' )
105105
106106 # Create the feed's attributes.
107107 feed_attribute_url = feed .attributes .add ()
@@ -113,7 +113,7 @@ def create_feed(client, customer_id):
113113 feed_attribute_label .name .value = 'Label'
114114
115115 # Retrieve the feed service.
116- feed_service = client .get_service ('FeedService' , version = 'v2 ' )
116+ feed_service = client .get_service ('FeedService' , version = 'v3 ' )
117117 # Send the feed operation and add the feed.
118118 response = feed_service .mutate_feeds (customer_id , [feed_operation ])
119119
@@ -142,7 +142,7 @@ def get_feed_details(client, customer_id, resource_name):
142142 LIMIT 1
143143 ''' .format (resource_name )
144144
145- ga_service = client .get_service ('GoogleAdsService' , version = 'v2 ' )
145+ ga_service = client .get_service ('GoogleAdsService' , version = 'v3 ' )
146146 response = ga_service .search (customer_id , query = query )
147147
148148 # Maps specific fields in each row in the response to a dict. This would
@@ -167,14 +167,14 @@ def create_feed_mapping(client, customer_id, feed_details):
167167 """
168168 # Retrieve a new feed mapping operation object.
169169 feed_mapping_operation = client .get_type ('FeedMappingOperation' ,
170- version = 'v2 ' )
170+ version = 'v3 ' )
171171 # Create a new feed mapping.
172172 feed_mapping = feed_mapping_operation .create
173173 feed_mapping .criterion_type = client .get_type (
174- 'FeedMappingCriterionTypeEnum' , version = 'v2 ' ).DSA_PAGE_FEED
174+ 'FeedMappingCriterionTypeEnum' , version = 'v3 ' ).DSA_PAGE_FEED
175175 feed_mapping .feed .value = feed_details .resource_name
176176 dsa_page_feed_field_enum = client .get_type ('DsaPageFeedCriterionFieldEnum' ,
177- version = 'v2 ' )
177+ version = 'v3 ' )
178178
179179 url_field_mapping = feed_mapping .attribute_field_mappings .add ()
180180 url_field_mapping .feed_attribute_id .value = feed_details .url_attribute_id
@@ -187,7 +187,7 @@ def create_feed_mapping(client, customer_id, feed_details):
187187
188188 # Retrieve the feed mapping service.
189189 feed_mapping_service = client .get_service ('FeedMappingService' ,
190- version = 'v2 ' )
190+ version = 'v3 ' )
191191 # Submit the feed mapping operation and add the feed mapping.
192192 response = feed_mapping_service .mutate_feed_mappings (
193193 customer_id , [feed_mapping_operation ])
@@ -213,7 +213,7 @@ def create_feed_items(client, customer_id, feed_details, label):
213213 "http://www.example.com/discounts/flight-deals" ]
214214
215215 def map_feed_urls (url ):
216- feed_item_operation = client .get_type ('FeedItemOperation' , version = 'v2 ' )
216+ feed_item_operation = client .get_type ('FeedItemOperation' , version = 'v3 ' )
217217 feed_item = feed_item_operation .create
218218 feed_item .feed .value = feed_details .resource_name
219219
@@ -235,7 +235,7 @@ def map_feed_urls(url):
235235 feed_item_operations = list (map (map_feed_urls , urls ))
236236
237237 # Retrieve the feed item service.
238- feed_item_service = client .get_service ('FeedItemService' , version = 'v2 ' )
238+ feed_item_service = client .get_service ('FeedItemService' , version = 'v3 ' )
239239 # Submit the feed item operations and add the feed items.
240240 response = feed_item_service .mutate_feed_items (customer_id ,
241241 feed_item_operations )
@@ -267,7 +267,7 @@ def update_campaign_dsa_setting(client, customer_id, campaign_id, feed_details):
267267 LIMIT 1
268268 ''' .format (campaign_id )
269269
270- ga_service = client .get_service ('GoogleAdsService' , version = 'v2 ' )
270+ ga_service = client .get_service ('GoogleAdsService' , version = 'v3 ' )
271271 results = ga_service .search (customer_id , query = query )
272272
273273 for row in results :
@@ -282,7 +282,7 @@ def update_campaign_dsa_setting(client, customer_id, campaign_id, feed_details):
282282 campaign_id ))
283283
284284 # Retrieve a new campaign operation
285- campaign_operation = client .get_type ('CampaignOperation' , version = 'v2 ' )
285+ campaign_operation = client .get_type ('CampaignOperation' , version = 'v3 ' )
286286 # Copy the retrieved campaign onto the new campaign operation.
287287 campaign_operation .update .CopyFrom (campaign )
288288 updated_campaign = campaign_operation .update
@@ -294,7 +294,7 @@ def update_campaign_dsa_setting(client, customer_id, campaign_id, feed_details):
294294 campaign_operation .update_mask .CopyFrom (field_mask )
295295
296296 # Retrieve the campaign service.
297- campaign_service = client .get_service ('CampaignService' , version = 'v2 ' )
297+ campaign_service = client .get_service ('CampaignService' , version = 'v3 ' )
298298 # Submit the campaign operation and update the campaign.
299299 response = campaign_service .mutate_campaigns (customer_id ,
300300 [campaign_operation ])
@@ -315,7 +315,7 @@ def add_dsa_targeting(client, customer_id, ad_group_resource_name, label):
315315 """
316316 # Retrieve a new ad group criterion operation object.
317317 ad_group_criterion_operation = client .get_type (
318- 'AdGroupCriterionOperation' , version = 'v2 ' )
318+ 'AdGroupCriterionOperation' , version = 'v3 ' )
319319 # Create a new ad group criterion.
320320 ad_group_criterion = ad_group_criterion_operation .create
321321 ad_group_criterion .ad_group .value = ad_group_resource_name
@@ -326,11 +326,11 @@ def add_dsa_targeting(client, customer_id, ad_group_resource_name, label):
326326 webpage_criterion_info = ad_group_criterion .webpage .conditions .add ()
327327 webpage_criterion_info .argument .value = label
328328 webpage_criterion_info .operand = client .get_type (
329- 'WebpageConditionOperandEnum' , version = 'v2 ' ).CUSTOM_LABEL
329+ 'WebpageConditionOperandEnum' , version = 'v3 ' ).CUSTOM_LABEL
330330
331331 # Retrieve the ad group criterion service.
332332 ad_group_criterion_service = client .get_service ('AdGroupCriterionService' ,
333- version = 'v2 ' )
333+ version = 'v3 ' )
334334 response = ad_group_criterion_service .mutate_ad_group_criteria (
335335 customer_id , [ad_group_criterion_operation ])
336336 resource_name = response .results [0 ].resource_name
0 commit comments