def CreateAdsWithCustomizations(client, adgroup_ids, feed_name):
 adgroup_ad_service = client.GetService('AdGroupAdService')
 expanded_text_ad = {'xsi_type': 'ExpandedTextAd', 'headlinePart1': ('Luxury Cruise to {=%s.Name}' % feed_name), 'headlinePart2': ('Only {=%s.Price}' % feed_name), 'description': ('Offer ends in {=countdown(%s.Date)}!' % feed_name), 'finalUrls': ['http://www.example.com']}
 operations = [{'operator': 'ADD', 'operand': {'adGroupId': adgroup, 'ad': expanded_text_ad}} for adgroup in adgroup_ids]
 response = adgroup_ad_service.mutate(operations)
 if (response and ('value' in response)):
  for ad in response['value']:
   print ("Created an ad with ID '%s', type '%s', and status '%s'." % (ad['ad']['id'], ad['ad']['Ad.Type'], ad['status']))
 else:
  raise errors.GoogleAdsError('No ads were added.')

def CreateAdsWithCustomizations ( client , adgroup_ids , feed_name ) : adgroup_ad_service = client . GetService ( 'AdGroupAdService' ) expanded_text_ad = { 'xsi_type' : 'ExpandedTextAd' , 'headlinePart1' : ( 'Luxury Cruise to {=%s.Name}' % feed_name ) , 'headlinePart2' : ( 'Only {=%s.Price}' % feed_name ) , 'description' : ( 'Offer ends in {=countdown(%s.Date)}!' % feed_name ) , 'finalUrls' : [ 'http://www.example.com' ] } operations = [ { 'operator' : 'ADD' , 'operand' : { 'adGroupId' : adgroup , 'ad' : expanded_text_ad } } for adgroup in adgroup_ids ] response = adgroup_ad_service . mutate ( operations ) if ( response and ( 'value' in response ) ) : for ad in response [ 'value' ] : print ( "Created an ad with ID '%s', type '%s', and status '%s'." % ( ad [ 'ad' ] [ 'id' ] , ad [ 'ad' ] [ 'Ad.Type' ] , ad [ 'status' ] ) ) else : raise errors . GoogleAdsError ( 'No ads were added.' )
creates expandedtextads that use ad customizations for specified adgroups .