Hello,
I am looking to use a batch process in python to create campaigns using the 
Google Ads API. 

I want to create callout_assets to be attached to the campaigns through 
campaign_assets. I am running into a problem where I am unable to assign a 
resource_name to the callout_asset which can latter be used to attach the 
callout_asset to a campaign_asset. 

Any ideas how I can solution for this. 

Code extract for the section I am getting error in is below

def build_campaign_callout_assets(client, campaign_operation):
    calloutstext = ['callout #1', 'callout #2', 'callout #3', 'callout #4']
    return [
        build_campaign_callout_asset(client, campaign_operation, 
callouttext)
        for callouttext in calloutstext
    ]

def build_campaign_callout_asset(client, callouttext):
    asset_operation = client.get_type("AssetOperation")
    asset = asset_operation.create.callout_asset
    asset.callout_text = callouttext
    asset.resource_name = callouttext <============ AttributeError: 
Protocol message CalloutAsset has no "resource_name" field. 

    return asset_operation

def build_campaign_assets(client, campaign_operations, asset_operations):
    return [
        build_campaign_asset(client, campaign_operation, asset_operation)
        for campaign_operation in campaign_operations
            for asset_operation in asset_operations
    ]

def build_campaign_asset(client, campaign_operation,  asset_operation ):
    campaign_asset_operation = client.get_type("CampaignAssetOperation")
    campaign_asset = campaign_asset_operation.create
    campaign_asset.asset =  asset_operation .create.resource_name    <===== 
LOOKING TO USE THE RESOUSE NAME HERE 
    campaign_asset.field_type = client.enums.AssetFieldTypeEnum.CALLOUT
    campaign_asset.campaign = campaign_operation.create.resource_name

    return campaign_asset_operation

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/f287f7f7-413d-4d2b-9e56-05178a6378e5n%40googlegroups.com.
  • Ba... Antony Kyalo Musyoki
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Antony Kyalo Musyoki

Reply via email to