I have everything set up on my google adwords account and I'm able to retrieve data via the API. However, I just can't seem to find how I'm supposed to add IP addresses to the blacklist

I know that I should be using IPBlock, I just don't know how

I found an old code that goes like this:

from google.ads.googleads.client import GoogleAdsClient client = (GoogleAdsClient.load_from_storage(path="google-ads.yaml")) campaign_criterion_operation = client.get_type('CampaignCriterionOperation', version='v2') campaign_criterion = campaign_criterion_operation.create campaign_criterion.negative.value = True campaign_criterion.campaign.value = campaign_service.campaign_path(customer, campaign) campaign_criterion.ip_block.ip_address.value = "80.67.167.81" campaign_criterion_response = campaign_criterion_service.mutate_campaign_criteria(customer, [campaign_criterion_operation]) for reponse in campaign_criterion_response.results:     print('Added campaign criterion "%s".' % reponse.resource_name) 

However, it has multiple issues if you try to run it.

Any help would be greatly appreciated!

Tag:google-ads-api, python

Add a new comment.