Skip to content

Commit

Permalink
updates to get_responsive_search_ads example (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
wihl authored Mar 5, 2020
1 parent af717cc commit 0fc8a7d
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions examples/basic_operations/get_responsive_search_ads.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ def main(client, customer_id, page_size, ad_group_id=None):
WHERE ad_group_ad.ad.type = RESPONSIVE_SEARCH_AD
AND ad_group_ad.status != "REMOVED"'''

# Optional: Specify an ad group ID to restrict search to only a given
# ad group.
if ad_group_id:
query = query + f' AND ad_group.id = {ad_group_id}'

Expand All @@ -56,16 +58,11 @@ def main(client, customer_id, page_size, ad_group_id=None):
f'"{ad.resource_name}", '
f'status {aga_status_enum.Name(row.ad_group_ad.status)} '
f'was found.')
if ad.responsive_search_ad:
responsive_search_ad_info = ad.responsive_search_ad
print('Headlines:\n{}\n'
'Descriptions:\n{}\n'.format(
'\n'.join(_ad_text_assets_to_strs(
client, responsive_search_ad_info.headlines)),
'\n'.join(_ad_text_assets_to_strs(
client, responsive_search_ad_info.descriptions))))
else:
print('\tResponsive search ad info was not found.')
print('Headlines:\n{}\nDescriptions:\n{}\n'.format(
'\n'.join(_ad_text_assets_to_strs(
client, ad.responsive_search_ad.headlines)),
'\n'.join(_ad_text_assets_to_strs(
client, ad.responsive_search_ad.descriptions))))

if not one_found:
print('No responsive search ads were found.')
Expand Down

0 comments on commit 0fc8a7d

Please sign in to comment.