Thanks Teja,

What version of Python are you running? 

Do I need to have any other packages installed besides googleads? Are you 
sure you made no changes to my base code when you ran it?

I'm still getting the same error:

File "keyword_planner.py", line 93, in <module>

    main(adwords_client)

  File "keyword_planner.py", line 64, in main

    page = targeting_idea_service.get(selector)

  File 
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/googleads/common.py",
 
line 1389, in MakeSoapRequest

    e.detail, errors=error_list, message=e.message)

googleads.errors.GoogleAdsServerFault: 
[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ 
selector.searchParameters.searchParameters[0]; 
trigger:'RelatedToQuerySearchParameter']

On Friday, September 21, 2018 at 2:54:03 PM UTC-6, Teja Makani wrote:
>
> Hello Cameron, 
>
> The TargetingIdeaError.INVALID_ <http://targetingideaerror.invalid_/>
> SEARCH_PARAMETERS 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.TargetingIdeaError#reason>
>  error 
> occurs when a SearchParameter 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.SearchParameter.html>
>  does 
> not match the IdeaType 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.IdeaType.html>
>  specified 
> in the TargetingIdeaSelector 
> <https://developers.google.com/adwords/api/docs/reference/v201806/TargetingIdeaService.TargetingIdeaSelector.html>
>  or 
> is otherwise invalid. Looks like you are trying to run 
> get_keyword_ideas.py 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgoogleads%2Fgoogleads-python-lib%2Fblob%2Fcd707dc897b93cf1bbb19355f7424e7834e7fb55%2Fexamples%2Fadwords%2Fv201802%2Foptimization%2Fget_keyword_ideas.py&sa=D&sntz=1&usg=AFQjCNHCMgT9_b2i2A37vkPJITCbuwAr9A>.
>  
> I ran the same example commenting out the optional lines and able to fetch 
> the results for keyword ideas. Even I ran your code and it works fine. If 
> the problem persists could you please share the SOAP logs(request and 
> response) without redacting any information. Please follow the instruction 
> shown in this README.md 
> <https://www.google.com/url?q=https%3A%2F%2Fgithub.com%2Fgoogleads%2Fgoogleads-python-lib%2Fblob%2Fmaster%2FREADME.md%23how-do-i-log-soap-interactions&sa=D&sntz=1&usg=AFQjCNGDShwQmdIkMz6CwV69dZPRZdbyVg>
>  file 
> to enable logging. 
>
> Regards,
> Sai Teja, AdWords API Team.
>
> On Friday, September 21, 2018 at 3:12:28 PM UTC-4, Cameron Warren wrote:
>>
>> Running code to pull data from the TargetingIdeaService SOAP api. I'm 
>> using the example exactly as written of the google github repository (see 
>> code below).
>>
>> Oauth and everything else working fine. Here is the error:
>>
>> suds.WebFault: Server raised fault: 
>> '[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ 
>> selector.searchParameters.searchParameters[0]; 
>> trigger:'RelatedToQuerySearchParameter']'
>>
>>
>>
>> If anyone know's what's going on here - you're help is greatly 
>> appreciated!
>>
>>
>>
>>
>> AD_GROUP_ID = None
>> PAGE_SIZE = 100
>>
>> def main(client, ad_group_id=None):
>>   # Initialize appropriate service.
>>   targeting_idea_service = client.GetService(
>>       'TargetingIdeaService', version='v201802')
>>
>>   # Construct selector object and retrieve related keywords.
>>   selector = {
>>       'ideaType': 'KEYWORD',
>>       'requestType': 'IDEAS'
>>   }
>>
>>   selector['requestedAttributeTypes'] = [
>>       'KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES']
>>
>>   offset = 0
>>   selector['paging'] = {
>>       'startIndex': str(offset),
>>       'numberResults': str(PAGE_SIZE)
>>   }
>>
>>   selector['searchParameters'] = [{
>>       'xsi_type': 'RelatedToQuerySearchParameter',
>>       'queries': ['baseball']
>>   }]
>>
>>   # # Language setting (optional).
>>   # selector['searchParameters'].append({
>>   #     # The ID can be found in the documentation:
>>   #     # 
>> https://developers.google.com/adwords/api/docs/appendix/languagecodes
>>   #     'xsi_type': 'LanguageSearchParameter',
>>   #     'languages': [{'id': '1000'}]
>>   # })
>>
>>   # # Network search parameter (optional)
>>   # selector['searchParameters'].append({
>>   #     'xsi_type': 'NetworkSearchParameter',
>>   #     'networkSetting': {
>>   #         'targetGoogleSearch': True,
>>   #         'targetSearchNetwork': False,
>>   #         'targetContentNetwork': False,
>>   #         'targetPartnerSearchNetwork': False
>>   #     }
>>   # })
>>
>>   # # Use an existing ad group to generate ideas (optional)
>>   # if ad_group_id is not None:
>>   #   selector['searchParameters'].append({
>>   #       'xsi_type': 'SeedAdGroupIdSearchParameter',
>>   #       'adGroupId': ad_group_id
>>   #   })
>>
>>   more_pages = True
>>   while more_pages:
>>     page = targeting_idea_service.get(selector)
>>
>>     # Display results.
>>     if 'entries' in page:
>>       for result in page['entries']:
>>         attributes = {}
>>         for attribute in result['data']:
>>           attribute_value = attribute['value']
>>           if 'value' in attribute_value:
>>             attributes[attribute['key']] = attribute_value['value']
>>           else:
>>             attributes[attribute['key']] = []
>>         print ('Keyword with "%s" text and average monthly search volume '
>>                '"%s" was found with Products and Services categories: %s.'
>>                % (attributes['KEYWORD_TEXT'],
>>                   attributes['SEARCH_VOLUME'],
>>                   attributes['CATEGORY_PRODUCTS_AND_SERVICES']))
>>       print
>>     else:
>>       print 'No related keywords were found.'
>>     offset += PAGE_SIZE
>>     selector['paging']['startIndex'] = str(offset)
>>     more_pages = offset < int(page['totalNumEntries'])
>>
>>
>> if __name__ == '__main__':
>>   # Initialize client object.
>>   adwords_client = adwords.AdWordsClient.LoadFromStorage()
>>
>>   main(adwords_client)
>>
>>
>>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/9f84a4c3-c6cf-48b1-b659-62384b1f19c4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to