Closed Light-jason closed 10 months ago
@Light-jason what error do you receive when you submit this request to the API?
@Light-jason after taking a closer look I see the problem. Instead of setting the campaign.asset_automation_settings
field to a tuple, do the following:
# Since the AssetAutomationMessage is defined in the same file as Campaign, in this library it exists as a property on the Campaign class.
asset_automation_setting = campaign.AssetAutomationSetting()
asset_automation_setting.asset_automation_type = client.enums.AssetAutomationTypeEnum.TEXT_ASSET_AUTOMATION
asset_automation_setting.asset_automation_status = client.enums.AssetAutomationStatusEnum.OPTED_OUT
campaign.asset_automation_settings.append(asset_automation_setting)
@Light-jason after taking a closer look I see the problem. Instead of setting the
campaign.asset_automation_settings
field to a tuple, do the following:# Since the AssetAutomationMessage is defined in the same file as Campaign, in this library it exists as a property on the Campaign class. asset_automation_setting = campaign.AssetAutomationSetting() asset_automation_setting.asset_automation_type = client.enums.AssetAutomationTypeEnum.TEXT_ASSET_AUTOMATION asset_automation_setting.asset_automation_status = client.enums.AssetAutomationStatusEnum.OPTED_OUT campaign.asset_automation_settings.append(asset_automation_setting)
thanks~ I would try this way.
@Light-jason after taking a closer look I see the problem. Instead of setting the
campaign.asset_automation_settings
field to a tuple, do the following:# Since the AssetAutomationMessage is defined in the same file as Campaign, in this library it exists as a property on the Campaign class. asset_automation_setting = campaign.AssetAutomationSetting() asset_automation_setting.asset_automation_type = client.enums.AssetAutomationTypeEnum.TEXT_ASSET_AUTOMATION asset_automation_setting.asset_automation_status = client.enums.AssetAutomationStatusEnum.OPTED_OUT campaign.asset_automation_settings.append(asset_automation_setting)
when I used this code to close the text_asset_automation. The error is happened that "TypeError: Parameter to MergeFrom() must be instance of same class: expected google.ads.googleads.v16.resources.Campaign.AssetAutomationSetting got AssetAutomationSetting. "
I want to create a pmax campaign through api, and set the asset_automation as OPTED_OUT.
Here is my code, but it is wrong. ` mutate_operation = self.client.get_type("MutateOperation") campaign = mutate_operation.campaign_operation.create campaign.name = f"Performance Max campaign #{uuid4()}" if not campaign_name else campaign_name
`