我的帐户中有一个广告定制工具供稿设置,我想更改该供稿中一项的值。我尝试使用“ FeedItemService”中的“ SET”操作来做到这一点
运行它时,出现以下错误:
KeyError: 'feedAttributes'
我还在这里查看了“ ADD”新feedItem代码示例: https://developers.google.com/adwords/api/docs/guides/ad-customizers
但是,这仅是添加新项目,而不是修改(设置)它们。
这是代码段:
fi_service = adwords_client.GetService('FeedItemService', version = 'v201809')
fi_operator = {
'feedId': 1234,
'feedItemId': 3456,
'attributeValues': [
{
'feedAttributeId':111,
'stringValue': '1000'}
]
}
fi_creator_operation = {'operator': 'SET',
'operand': fi_operator}
fi_call_response = fi_service.mutate(feed_creator_operation)
这是回溯:
Traceback (most recent call last):
File "<ipython-input-57-892b092f7b88>", line 15, in <module>
fi_call_response = fi_service.mutate(feed_creator_operation)
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1381, in MakeSoapRequest
packed_args = self._PackArguments(method_name, args)
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1239, in _PackArguments
for ((_, param), param_data) in izip(op_params, args)]
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1284, in _PackArgumentsHelper
elem_type, type_override is not None, data_formatted, set_type_attrs)
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1351, in _CreateComplexTypeFromData
for k, v in data if k != 'xsi_type'}
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1351, in <dictcomp>
for k, v in data if k != 'xsi_type'}
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1284, in _PackArgumentsHelper
elem_type, type_override is not None, data_formatted, set_type_attrs)
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1351, in _CreateComplexTypeFromData
for k, v in data if k != 'xsi_type'}
File "C:\ProgramData\Anaconda2\lib\site-packages\googleads\common.py", line 1351, in <dictcomp>
for k, v in data if k != 'xsi_type'}
KeyError: 'feedAttributes'
我尝试过在各种字典(fi_operator,attributeValues,fi_creator_operation)中添加('xsi_type':'feedAttributes'),以防万一它起作用,但是,我仍然得到相同的响应。