Hi community, I am struggling to work out how to change keyword status via the Google Ads API using the Python library. I have no problem pausing and enabling AdGroups, or adding new keywords, but there is no exact model for this in the sample code, and my alterations are not working as expected. Here is the function I'm trying, based closely on the sample code:
def enableKeyword(client, ad_group_id, criterion_id): # Initialize appropriate service. ad_group_criterion_service = client.GetService( 'AdGroupCriterionService', version='v201806') # Construct operations and update bids. operations = [{ 'operator': 'SET', 'operand': { 'adGroupId': ad_group_id, 'criterion': { 'id': criterion_id }, 'userStatus': 'ENABLED' } }] ad_group_criteria = ad_group_criterion_service.mutate(operations) # Display results. if 'value' in ad_group_criteria: for criterion in ad_group_criteria['value']: if criterion['criterion']['Criterion.Type'] == 'Keyword': print(('Ad group criterion with ad group id "%s" and criterion id ' '"%s" currently has bids:' % (criterion['adGroupId'], criterion['criterion']['id']))) for bid in criterion['biddingStrategyConfiguration']['bids']: print('\tType: "%s", value: %s' % (bid['Bids.Type'], bid['bid']['microAmount'])) else: print('No ad group criteria were updated.') As far as I can see this follows the same structure as the (apparently) functioning C# code posted here: https://stackoverflow.com/questions/28046602/how-to-update-keyword-status-maxcpc-and-keyword-text-using-google-adwords-api?rq=1 but Python just gives me a KeyError complaining about userStatus - so it's obviously not expected there. What am I missing? Cheers, Tom -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 adwords-api@googlegroups.com To unsubscribe from this group, send email to adwords-api+unsubscr...@googlegroups.com 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 "AdWords API and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. Visit this group at https://groups.google.com/group/adwords-api. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/4f3e183d-88a3-4304-bf8a-9f56373fc83c%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.