googleads.errors.GoogleAdsServerFault: TargetingIdeaError.INVALID_SEARCH_PARAMETERS in python

5 views
Skip to first unread message

김태원

unread,
Jan 31, 2019, 5:46:00 AM1/31/19
to AdWords API and Google Ads API Forum
Hi

I am testing TargetingIdeaService (google ads api). However, the source code suggested by Google does not work and I am posting a question here.

The source code is written the same as the sample code, but [TargetingIdeaError.INVALID_SEARCH_PARAMETERS] error is occurring.

Has anyone solved this problem?
Thank you for your help.

The attachment is the source file you are creating.

Please write down some of the source code and error logs below and I would appreciate your help.

>>> Source Code
adwords_client = adwords.AdWordsClient.LoadFromStorage('googleads.yaml')
targeting_idea_service = adwords_client.GetService('TargetingIdeaService', version='v201809')
offset = 0
PAGE_SIZE = 100
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': ['space cruise','hyundai sonata']
}]

logging.basicConfig(level=logging.INFO, format=googleads.util.LOGGER_FORMAT)
logging.getLogger('googleads.soap').setLevel(logging.DEBUG)
print('==================== Debug')
page = targeting_idea_service.get(selector)
for result in page['entries']:
attributes = {}
for attribute in result['data']:
attributes[attribute['key']] = getattr(
attribute['value'], 'value', '0')
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('==================== result')

>>> Error Log

[2019-01-31 11:10:47,506 - googleads.soap - INFO] Request made: Service: "TargetingIdeaService" Method: "get" URL: "https://adwords.google.com/api/adwords/o/v201809/TargetingIdeaService"
[2019-01-31 11:10:47,507 - googleads.soap - DEBUG] Outgoing request: {'SOAPAction': '""', 'Content-Type': 'text/xml; charset=utf-8', 'authorization': 'REDACTED'}
<soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/envelope/">
<soap-env:Header>
<ns0:RequestHeader xmlns:ns0="https://adwords.google.com/api/adwords/o/v201809">
<ns1:developerToken xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809">YgvqxXzMNMs9POV6b1ICwg</ns1:developerToken>
<ns2:userAgent xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">unknown (AwApi-Python, googleads/15.0.2, Python/3.7.1, zeep)</ns2:userAgent>
<ns3:validateOnly xmlns:ns3="https://adwords.google.com/api/adwords/cm/v201809">false</ns3:validateOnly>
<ns4:partialFailure xmlns:ns4="https://adwords.google.com/api/adwords/cm/v201809">false</ns4:partialFailure>
</ns0:RequestHeader>
</soap-env:Header>
<soap-env:Body>
<ns0:selector>
<ns0:searchParameters xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns0:RelatedToQuerySearchParameter">
<ns0:queries>space</ns0:queries>
</ns0:searchParameters>
<ns0:ideaType>KEYWORD</ns0:ideaType>
<ns0:requestType>IDEAS</ns0:requestType>
<ns0:requestedAttributeTypes>KEYWORD_TEXT</ns0:requestedAttributeTypes>
<ns0:requestedAttributeTypes>SEARCH_VOLUME</ns0:requestedAttributeTypes>
<ns0:requestedAttributeTypes>CATEGORY_PRODUCTS_AND_SERVICES</ns0:requestedAttributeTypes>
<ns0:paging>
<ns1:startIndex xmlns:ns1="https://adwords.google.com/api/adwords/cm/v201809">0</ns1:startIndex>
<ns2:numberResults xmlns:ns2="https://adwords.google.com/api/adwords/cm/v201809">100</ns2:numberResults>
</ns0:paging>
</ns0:selector>
</ns0:get>
</soap-env:Body>
</soap-env:Envelope>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<ns2:requestId>000580b788f6da410aa30069080f98f1</ns2:requestId>
<ns2:serviceName>TargetingIdeaService</ns2:serviceName>
<ns2:methodName>get</ns2:methodName>
<ns2:operations>1</ns2:operations>
<ns2:responseTime>131</ns2:responseTime>
</ResponseHeader>
</soap:Header>
<soap:Body>
<soap:Fault>
<faultcode>soap:Server</faultcode>
<faultstring>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:\'RelatedToQuerySearchParameter\']</faultstring>
<detail>
<ns2:message>[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:\'RelatedToQuerySearchParameter\']</ns2:message>
<ns2:ApplicationException.Type>ApiException</ns2:ApplicationException.Type>
<ns2:errors xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="TargetingIdeaError">
<ns2:fieldPath>selector.searchParameters.searchParameters[0]</ns2:fieldPath>
<ns2:fieldPathElements>
<ns2:field>selector</ns2:field>
</ns2:fieldPathElements>
<ns2:fieldPathElements>
<ns2:field>searchParameters</ns2:field>
</ns2:fieldPathElements>
<ns2:fieldPathElements>
<ns2:field>searchParameters</ns2:field>
<ns2:index>0</ns2:index>
</ns2:fieldPathElements>
<ns2:trigger>RelatedToQuerySearchParameter</ns2:trigger>
<ns2:errorString>TargetingIdeaError.INVALID_SEARCH_PARAMETERS</ns2:errorString>
<ns2:ApiError.Type>TargetingIdeaError</ns2:ApiError.Type>
<reason>INVALID_SEARCH_PARAMETERS</reason>
</ns2:errors>
</ApiExceptionFault>
</detail>
</soap:Fault>
</soap:Body>
</soap:Envelope>


2019-01-31 11:10:49,097 - googleads.soap - WARNING] Error summary: {'faultMessage': "[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:'RelatedToQuerySearchParameter']", 'requestId': '000580b788f6da410aa30069080f98f1', 'serviceName': 'TargetingIdeaService', 'methodName': 'get', 'operations': '1', 'responseTime': '131'}
[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:'RelatedToQuerySearchParameter']
[TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:'RelatedToQuerySearchParameter']
Traceback (most recent call last):
File "/Users/tw.kim/Documents/myApp/pythontest/youtubeTest/lib/python3.7/site-packages/googleads/common.py", line 1382, in MakeSoapRequest
*packed_args, _soapheaders=soap_headers)['body']['rval']
File "/Users/tw.kim/Documents/myApp/pythontest/youtubeTest/lib/python3.7/site-packages/zeep/proxy.py", line 42, in __call__
self._op_name, args, kwargs)
File "/Users/tw.kim/Documents/myApp/pythontest/youtubeTest/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 132, in send
return self.process_reply(client, operation_obj, response)
File "/Users/tw.kim/Documents/myApp/pythontest/youtubeTest/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 194, in process_reply
return self.process_error(doc, operation)
File "/Users/tw.kim/Documents/myApp/pythontest/youtubeTest/lib/python3.7/site-packages/zeep/wsdl/bindings/soap.py", line 299, in process_error
detail=fault_node.find('detail'))
zeep.exceptions.Fault: [TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:'RelatedToQuerySearchParameter']

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "20190130.py", line 28, in <module>
page = targeting_idea_service.get(selector)
File "/Users/tw.kim/Documents/myApp/pythontest/youtubeTest/lib/python3.7/site-packages/googleads/common.py", line 1396, in MakeSoapRequest
e.detail, errors=error_list, message=e.message)
googleads.errors.GoogleAdsServerFault: [TargetingIdeaError.INVALID_SEARCH_PARAMETERS @ selector.searchParameters.searchParameters[0]; trigger:'RelatedToQuerySearchParameter']
20190130.py
Reply all
Reply to author
Forward
This conversation is locked
You cannot reply and perform actions on locked conversations.
0 new messages