【发布时间】:2019-05-06 20:10:55
【问题描述】:
我正在尝试使用 CampaignService() 通过适用于 Python 的 Adwords API (3) 检索字段“biddingStrategyConfiguration”,但我总是收到一个奇怪的错误。这很奇怪,因为该字段确实存在,如文档 found here 中所述。
account_id = 'any_id'
adwords = Adwords(account_id) # classes and objects already created, etc.
def get_bidding_strategy():
service = adwords.client.GetService('CampaignService', version = 'v201806')
selector = {
'fields': ['Id', 'Name', 'Status', 'biddingStrategyConfiguration']
}
results = service.get(selector)
data = []
if 'entries' in results:
for item in results['entries']:
if item['status'] == 'ENABLED':
data.append({
'id': item['id'],
'name': item['name'],
'status': item['status'] # i have to retrieve biddingStrategyConfiguration.biddingStrategyName (next line)
})
return results
这是错误:
Error summary:
{'faultMessage': "[SelectorError.INVALID_FIELD_NAME @ serviceSelector; trigger:'biddingStrategyConfiguration']",
'requestId': '000581286e61247e0a376ac776062df4',
'serviceName': 'CampaignService',
'methodName': 'get',
'operations': '1',
'responseTime': '315'}
请注意,“id”或“name”等字段很容易检索,但出价配置则不然。事实上,我正在使用 .biddingStrategyID 或 .biddingStrategyName 查找 biddingStrategies 的 ID/名称。
谁能帮帮我?提前致谢。
【问题讨论】:
-
没关系,我只是在愚蠢。您不必检索biddingStrategyConfiguration.biddingStrategyName,只需检索biddingStrategyName即可。
-
你能在这里更新你的代码吗?我遇到了同样的问题,但仍然不知道如何解决。谢谢。
-
查看我对 BiddingStrategyType 的编辑,现在可以使用
标签: python google-ads-api