Skip to content

Commit 2e100cb

Browse files
authored
Changes for release v16_0. (#841)
1 parent 720b39e commit 2e100cb

File tree

1,535 files changed

+234893
-2964
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,535 files changed

+234893
-2964
lines changed

ChangeLog

+8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,11 @@
1+
* 23.1.0
2+
- Google Ads API v16 release.
3+
- Use native `open` function to load README in setup.py.
4+
- Remove `namespace_packages` parameter in call to `setup` in setup.py.
5+
- Remove `upload_image` and `upload_media_bundle` examples.
6+
- Combine detect and apply recommendations examples.
7+
- Update extensions-related examples to use assets instead.
8+
19
* 23.0.0
210
- Remove support for Python 3.7
311
- Add support for Python 3.11 and 3.12

examples/account_management/create_customer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def main(client, manager_customer_id):
5858
if __name__ == "__main__":
5959
# GoogleAdsClient will read the google-ads.yaml configuration file in the
6060
# home directory if none is specified.
61-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
61+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
6262

6363
parser = argparse.ArgumentParser(
6464
description=("Creates a new client under the given manager.")

examples/account_management/get_account_hierarchy.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def print_account_hierarchy(
179179
if __name__ == "__main__":
180180
# GoogleAdsClient will read the google-ads.yaml configuration file in the
181181
# home directory if none is specified.
182-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
182+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
183183

184184
parser = argparse.ArgumentParser(
185185
description="This example gets the account hierarchy of the specified "

examples/account_management/get_change_details.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ def main(client, customer_id):
186186
if __name__ == "__main__":
187187
# GoogleAdsClient will read the google-ads.yaml configuration file in the
188188
# home directory if none is specified.
189-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
189+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
190190

191191
parser = argparse.ArgumentParser(
192192
description="This example gets specific details about the most recent "

examples/account_management/get_change_summary.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ def main(client, customer_id):
8585
if __name__ == "__main__":
8686
# GoogleAdsClient will read a google-ads.yaml configuration file in the
8787
# home directory if none is specified.
88-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
88+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
8989

9090
parser = argparse.ArgumentParser(
9191
description=(

examples/account_management/invite_user_with_access_role.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ def main(client, customer_id, email_address, access_role):
5959
if __name__ == "__main__":
6060
# GoogleAdsClient will read the google-ads.yaml configuration file in the
6161
# home directory if none is specified.
62-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
62+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
6363

6464
parser = argparse.ArgumentParser(
6565
description=(

examples/account_management/link_manager_to_client.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def main(client, customer_id, manager_customer_id):
112112
if __name__ == "__main__":
113113
# GoogleAdsClient will read the google-ads.yaml configuration file in the
114114
# home directory if none is specified.
115-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
115+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
116116

117117
parser = argparse.ArgumentParser(
118118
description=(

examples/account_management/list_accessible_customers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def main(client):
4444
if __name__ == "__main__":
4545
# GoogleAdsClient will read the google-ads.yaml configuration file in the
4646
# home directory if none is specified.
47-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
47+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
4848

4949
try:
5050
main(googleads_client)

examples/account_management/update_user_access.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ def modify_user_access(client, customer_id, user_id, access_role):
137137
if __name__ == "__main__":
138138
# GoogleAdsClient will read the google-ads.yaml configuration file in the
139139
# home directory if none is specified.
140-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
140+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
141141

142142
parser = argparse.ArgumentParser(
143143
description="This code example updates the access role of a user, "

examples/advanced_operations/add_ad_customizer.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ def create_ad_with_customizations(
263263
if __name__ == "__main__":
264264
# GoogleAdsClient will read the google-ads.yaml configuration file in the
265265
# home directory if none is specified.
266-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
266+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
267267

268268
parser = argparse.ArgumentParser(
269269
description=(

examples/advanced_operations/add_ad_group_bid_modifier.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def main(client, customer_id, ad_group_id, bid_modifier_value):
6565
if __name__ == "__main__":
6666
# GoogleAdsClient will read the google-ads.yaml configuration file in the
6767
# home directory if none is specified.
68-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
68+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
6969

7070
parser = argparse.ArgumentParser(
7171
description=(

examples/advanced_operations/add_app_campaign.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ def create_ad_text_asset(client, text):
295295
if __name__ == "__main__":
296296
# GoogleAdsClient will read the google-ads.yaml configuration file in the
297297
# home directory if none is specified.
298-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
298+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
299299

300300
parser = argparse.ArgumentParser(
301301
description=(

examples/advanced_operations/add_bidding_data_exclusion.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def main(client, customer_id, start_date_time, end_date_time):
8080
if __name__ == "__main__":
8181
# GoogleAdsClient will read the google-ads.yaml configuration file in the
8282
# home directory if none is specified.
83-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
83+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
8484

8585
parser = argparse.ArgumentParser(
8686
description="Adds a data exclusion for conversions in Smart Bidding "

examples/advanced_operations/add_bidding_seasonality_adjustment.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def main(
9494
if __name__ == "__main__":
9595
# GoogleAdsClient will read the google-ads.yaml configuration file in the
9696
# home directory if none is specified.
97-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
97+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
9898

9999
parser = argparse.ArgumentParser(
100100
description="Adds a seasonality adjustment for conversions in Smart "

examples/advanced_operations/add_call_ad.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def main(
101101
if __name__ == "__main__":
102102
# GoogleAdsClient will read the google-ads.yaml configuration file in the
103103
# home directory if none is specified.
104-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
104+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
105105

106106
parser = argparse.ArgumentParser(
107107
description=("Adds a call extension to a specific account.")

examples/advanced_operations/add_display_upload_ad.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def create_display_upload_ad_group_ad(
150150
if __name__ == "__main__":
151151
# GoogleAdsClient will read the google-ads.yaml configuration file in the
152152
# home directory if none is specified.
153-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
153+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
154154

155155
parser = argparse.ArgumentParser(
156156
description="Adds a display upload ad to a given ad group."

examples/advanced_operations/add_dynamic_page_feed_asset.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def add_dsa_target(client, customer_id, ad_group_id, dsa_page_url_label):
260260
if __name__ == "__main__":
261261
# GoogleAdsClient will read the google-ads.yaml configuration file in the
262262
# home directory if none is specified.
263-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
263+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
264264

265265
parser = argparse.ArgumentParser(
266266
description=(

examples/advanced_operations/add_dynamic_search_ads.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ def add_webpage_criterion(client, customer_id, ad_group_resource_name):
260260
if __name__ == "__main__":
261261
# GoogleAdsClient will read the google-ads.yaml configuration file in the
262262
# home directory if none is specified.
263-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
263+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
264264

265265
parser = argparse.ArgumentParser(
266266
description=(

examples/advanced_operations/add_performance_max_campaign.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -670,7 +670,7 @@ def create_asset_group_signal_operation(client, customer_id, audience_id):
670670
if __name__ == "__main__":
671671
# GoogleAdsClient will read the google-ads.yaml configuration file in the
672672
# home directory if none is specified.
673-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
673+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
674674

675675
parser = argparse.ArgumentParser(
676676
description=("Creates a Performance Max campaign.")

examples/advanced_operations/add_responsive_search_ad_full.py

+63-24
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,9 @@
5151
_COUNTRY_CODE = "AR"
5252

5353

54-
def main(client, customer_id, omit_image_extensions, customizer_attribute_name=None):
54+
def main(
55+
client, customer_id, omit_image_extensions, customizer_attribute_name=None
56+
):
5557
"""
5658
The main method that creates all necessary entities for the example.
5759
@@ -75,7 +77,9 @@ def main(client, customer_id, omit_image_extensions, customizer_attribute_name=N
7577
# Create a budget, which can be shared by multiple campaigns.
7678
campaign_budget = create_campaign_budget(client, customer_id)
7779

78-
campaign_resource_name = create_campaign(client, customer_id, campaign_budget)
80+
campaign_resource_name = create_campaign(
81+
client, customer_id, campaign_budget
82+
)
7983

8084
ad_group_resource_name = create_ad_group(
8185
client, customer_id, campaign_resource_name
@@ -122,7 +126,9 @@ def create_customizer_attribute(client, customer_id, customizer_attribute_name):
122126

123127
# Issue a mutate request to add the customizer attribute and prints its
124128
# information.
125-
customizer_attribute_service = client.get_service("CustomizerAttributeService")
129+
customizer_attribute_service = client.get_service(
130+
"CustomizerAttributeService"
131+
)
126132
response = customizer_attribute_service.mutate_customizer_attributes(
127133
customer_id=customer_id, operations=[operation]
128134
)
@@ -153,13 +159,19 @@ def link_customizer_attribute_to_customer(
153159
# Create a customer customizer with the value to be used in the responsive
154160
# search ad.
155161
customer_customizer = operation.create
156-
customer_customizer.customizer_attribute = customizer_attribute_resource_name
157-
customer_customizer.value.type_ = client.enums.CustomizerAttributeTypeEnum.PRICE
162+
customer_customizer.customizer_attribute = (
163+
customizer_attribute_resource_name
164+
)
165+
customer_customizer.value.type_ = (
166+
client.enums.CustomizerAttributeTypeEnum.PRICE
167+
)
158168
# The ad customizer will dynamically replace the placeholder with this value
159169
# when the ad serves.
160170
customer_customizer.value.string_value = "100USD"
161171

162-
customer_customizer_service = client.get_service("CustomerCustomizerService")
172+
customer_customizer_service = client.get_service(
173+
"CustomerCustomizerService"
174+
)
163175
# Issue a mutate request to create the customer customizer and prints its
164176
# information.
165177
response = customer_customizer_service.mutate_customer_customizers(
@@ -192,7 +204,9 @@ def create_ad_text_asset(client, text, pinned_field=None):
192204
return ad_text_asset
193205

194206

195-
def create_ad_text_asset_with_customizer(client, customizer_attribute_resource_name):
207+
def create_ad_text_asset_with_customizer(
208+
client, customizer_attribute_resource_name
209+
):
196210
"""Create an AdTextAsset.
197211
Args:
198212
client: an initialized GoogleAdsClient instance.
@@ -230,7 +244,9 @@ def create_campaign_budget(client, customer_id):
230244
campaign_budget_operation = client.get_type("CampaignBudgetOperation")
231245
campaign_budget = campaign_budget_operation.create
232246
campaign_budget.name = f"Campaign budget {uuid.uuid4()}"
233-
campaign_budget.delivery_method = client.enums.BudgetDeliveryMethodEnum.STANDARD
247+
campaign_budget.delivery_method = (
248+
client.enums.BudgetDeliveryMethodEnum.STANDARD
249+
)
234250
campaign_budget.amount_micros = 500000
235251

236252
# Add budget.
@@ -256,7 +272,9 @@ def create_campaign(client, customer_id, campaign_budget):
256272
campaign_operation = client.get_type("CampaignOperation")
257273
campaign = campaign_operation.create
258274
campaign.name = f"Testing RSA via API {uuid.uuid4()}"
259-
campaign.advertising_channel_type = client.enums.AdvertisingChannelTypeEnum.SEARCH
275+
campaign.advertising_channel_type = (
276+
client.enums.AdvertisingChannelTypeEnum.SEARCH
277+
)
260278

261279
# Recommendation: Set the campaign to PAUSED when creating it to prevent
262280
# the ads from immediately serving. Set to ENABLED once you've added
@@ -433,7 +451,9 @@ def add_keywords(client, customer_id, ad_group_resource_name):
433451
ad_group_criterion.ad_group = ad_group_resource_name
434452
ad_group_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
435453
ad_group_criterion.keyword.text = _KEYWORD_TEXT_EXACT_1
436-
ad_group_criterion.keyword.match_type = client.enums.KeywordMatchTypeEnum.EXACT
454+
ad_group_criterion.keyword.match_type = (
455+
client.enums.KeywordMatchTypeEnum.EXACT
456+
)
437457

438458
# Uncomment the below line if you want to change this keyword to a negative target.
439459
# ad_group_criterion.negative = True
@@ -450,7 +470,9 @@ def add_keywords(client, customer_id, ad_group_resource_name):
450470
ad_group_criterion.ad_group = ad_group_resource_name
451471
ad_group_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
452472
ad_group_criterion.keyword.text = _KEYWORD_TEXT_PHRASE_1
453-
ad_group_criterion.keyword.match_type = client.enums.KeywordMatchTypeEnum.PHRASE
473+
ad_group_criterion.keyword.match_type = (
474+
client.enums.KeywordMatchTypeEnum.PHRASE
475+
)
454476

455477
# Uncomment the below line if you want to change this keyword to a negative target.
456478
# ad_group_criterion.negative = True
@@ -467,7 +489,9 @@ def add_keywords(client, customer_id, ad_group_resource_name):
467489
ad_group_criterion.ad_group = ad_group_resource_name
468490
ad_group_criterion.status = client.enums.AdGroupCriterionStatusEnum.ENABLED
469491
ad_group_criterion.keyword.text = _KEYWORD_TEXT_BROAD_1
470-
ad_group_criterion.keyword.match_type = client.enums.KeywordMatchTypeEnum.BROAD
492+
ad_group_criterion.keyword.match_type = (
493+
client.enums.KeywordMatchTypeEnum.BROAD
494+
)
471495

472496
# Uncomment the below line if you want to change this keyword to a negative target.
473497
# ad_group_criterion.negative = True
@@ -482,9 +506,11 @@ def add_keywords(client, customer_id, ad_group_resource_name):
482506
campaign_criterion_operations = operations
483507

484508
# Add keywords
485-
ad_group_criterion_response = ad_group_criterion_service.mutate_ad_group_criteria(
486-
customer_id=customer_id,
487-
operations=[*campaign_criterion_operations],
509+
ad_group_criterion_response = (
510+
ad_group_criterion_service.mutate_ad_group_criteria(
511+
customer_id=customer_id,
512+
operations=[*campaign_criterion_operations],
513+
)
488514
)
489515
for result in ad_group_criterion_response.results:
490516
print("Created keyword " f"{result.resource_name}.")
@@ -515,7 +541,9 @@ def add_geo_targeting(client, customer_id, campaign_resource_name):
515541
[_GEO_LOCATION_1, _GEO_LOCATION_2, _GEO_LOCATION_3]
516542
)
517543

518-
results = geo_target_constant_service.suggest_geo_target_constants(gtc_request)
544+
results = geo_target_constant_service.suggest_geo_target_constants(
545+
gtc_request
546+
)
519547

520548
operations = []
521549
for suggestion in results.geo_target_constant_suggestions:
@@ -526,7 +554,9 @@ def add_geo_targeting(client, customer_id, campaign_resource_name):
526554
f"from search term ({suggestion.search_term})."
527555
)
528556
# Create the campaign criterion for location targeting.
529-
campaign_criterion_operation = client.get_type("CampaignCriterionOperation")
557+
campaign_criterion_operation = client.get_type(
558+
"CampaignCriterionOperation"
559+
)
530560
campaign_criterion = campaign_criterion_operation.create
531561
campaign_criterion.campaign = campaign_resource_name
532562
campaign_criterion.location.geo_target_constant = (
@@ -535,8 +565,10 @@ def add_geo_targeting(client, customer_id, campaign_resource_name):
535565
operations.append(campaign_criterion_operation)
536566

537567
campaign_criterion_service = client.get_service("CampaignCriterionService")
538-
campaign_criterion_response = campaign_criterion_service.mutate_campaign_criteria(
539-
customer_id=customer_id, operations=[*operations]
568+
campaign_criterion_response = (
569+
campaign_criterion_service.mutate_campaign_criteria(
570+
customer_id=customer_id, operations=[*operations]
571+
)
540572
)
541573

542574
for result in campaign_criterion_response.results:
@@ -583,16 +615,23 @@ def add_images(client, customer_id, campaign_resource_name):
583615

584616
# Step 6.2 - Create Image Extension
585617
extension_feed_item_service = client.get_service("ExtensionFeedItemService")
586-
extension_feed_item_operation = client.get_type("ExtensionFeedItemOperation")
618+
extension_feed_item_operation = client.get_type(
619+
"ExtensionFeedItemOperation"
620+
)
587621
extension_feed_item = extension_feed_item_operation.create
588622
extension_feed_item.image_feed_item.image_asset = image_asset_resource_name
589623

590-
extension_feed_response = extension_feed_item_service.mutate_extension_feed_items(
591-
customer_id=customer_id, operations=[extension_feed_item_operation]
624+
extension_feed_response = (
625+
extension_feed_item_service.mutate_extension_feed_items(
626+
customer_id=customer_id, operations=[extension_feed_item_operation]
627+
)
592628
)
593629
image_resource_name = extension_feed_response.results[0].resource_name
594630

595-
print("Created an image extension with resource name: " f"'{image_resource_name}'")
631+
print(
632+
"Created an image extension with resource name: "
633+
f"'{image_resource_name}'"
634+
)
596635

597636
# Step 6.3 - Link Image Extension to RSA
598637
campaign_extension_setting_service = client.get_service(
@@ -622,7 +661,7 @@ def add_images(client, customer_id, campaign_resource_name):
622661
if __name__ == "__main__":
623662
# GoogleAdsClient will read the google-ads.yaml configuration file in the
624663
# home directory if none is specified.
625-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
664+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
626665

627666
parser = argparse.ArgumentParser(
628667
description=("Creates a Responsive Search Ad for specified customer.")

examples/advanced_operations/add_smart_campaign.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -811,7 +811,7 @@ def print_response_details(response):
811811
if __name__ == "__main__":
812812
# GoogleAdsClient will read the google-ads.yaml configuration file in the
813813
# home directory if none is specified.
814-
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
814+
googleads_client = GoogleAdsClient.load_from_storage(version="v16")
815815

816816
parser = argparse.ArgumentParser(description=("Creates a Smart campaign."))
817817
# The following argument(s) should be provided to run the example.

0 commit comments

Comments
 (0)