Google Adwords-客户ID为必填错误(Python)
我正在尝试使用GoogleAdWords测试API。我正在尝试连接到Google Adwords API,但不断出现以下错误:Google Adwords-客户ID为必填错误(Python),python,google-ads-api,Python,Google Ads Api,我正在尝试使用GoogleAdWords测试API。我正在尝试连接到Google Adwords API,但不断出现以下错误: googleads.errors.GoogleAdsServerFault: [AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'<null>'] 我的Python代码如下所示: # AdWordsClient configurations adwords: ########
googleads.errors.GoogleAdsServerFault: [AuthenticationError.CLIENT_CUSTOMER_ID_IS_REQUIRED @ ; trigger:'<null>']
我的Python代码如下所示:
# AdWordsClient configurations
adwords:
#############################################################################
# Required Fields #
#############################################################################
developer_token: **DEVELOPER TOKEN FROM PRODUCTION ACCOUNT PASTED HERE**
#############################################################################
# Optional Fields #
#############################################################################
# client_customer_id: **CLIENT CUSTOMER ID FROM MANAGER TEST ACCOUNT PASTED HERE**
# user_agent: INSERT_USER_AGENT_HERE
# partial_failure: True
# validate_only: True
#############################################################################
# OAuth2 Configuration #
# Below you may provide credentials for either the installed application or #
# service account flows. Remove or comment the lines for the flow you're #
# not using. #
#############################################################################
# The following values configure the client for the installed application
# flow.
client_id: **CLIENT ID FROM MANAGER TEST ACCOUNT PASTED HERE**
client_secret: **CLIENT CUSTOMER SECRET FROM MANAGER TEST ACCOUNT PASTED HERE**
refresh_token: **REFRESH TOKEN FROM OAUTH PLAYGROUND ON BEHALF OF MANAGER TEST ACCOUNT PASTED HERE**
# The following values configure the client for the service account flow.
# path_to_private_key_file: INSERT_PATH_TO_JSON_KEY_FILE_HERE
# delegated_account: INSERT_DOMAIN_WIDE_DELEGATION_ACCOUNT
#############################################################################
# ReportDownloader Headers #
# Below you may specify boolean values for optional headers that will be #
# applied to all requests made by the ReportDownloader utility by default. #
#############################################################################
# report_downloader_headers:
# skip_report_header: False
# skip_column_header: False
# skip_report_summary: False
# use_raw_enum_values: False
from googleads import adwords
adwords_client = adwords.AdWordsClient.LoadFromStorage('C:\Python36\google_adwords.yaml')
ad_group_service = adwords_client.GetService('TargetingIdeaService', version='v201806')
selector = {
'ideaType': 'KEYWORD',
'requestType': 'IDEAS'
}
selector['requestedAttributeTypes'] = [
'KEYWORD_TEXT', 'SEARCH_VOLUME', 'CATEGORY_PRODUCTS_AND_SERVICES']
offset = 0
selector['paging'] = {
'startIndex': str(offset),
'numberResults': str(5)
}
selector['searchParameters'] = [{
'xsi_type': 'RelatedToQuerySearchParameter',
'queries': ['dog']
}]
page = ad_group_service.get(selector)
print (page)
有人知道我哪里出错了吗?我想我的YAML文件有点问题,但无法确定它可能是什么。提前谢谢 您需要在配置文件中取消对client\u customer\u id行的注释,并插入您创建的测试帐户的id 该项被标记为可选项,因为有一个服务不需要它,而CustomerService允许您检索经过身份验证的用户的可访问帐户的ID 但对于所有其他服务,包括您想要访问的targetingDiaService,这是一个必需的设置