Google api Adwords API正在获取customerId

Google api Adwords API正在获取customerId,google-api,google-ads-api,Google Api,Google Ads Api,我有一个adwords用户的Oauth凭据,并且我能够成功地进行API调用以下载报告,但是我必须在customerId中硬编码,因为我不知道如何获取它 API中的的get()方法应该返回客户ID,但要传递给它的参数是什么 我尝试了一个GET请求 不带任何标头参数或正文参数,返回: "<html><body>No service was found.</body></html>". 与此不同,我不关心将用户添加到我的MCC帐户。以下是如何使用go

我有一个adwords用户的Oauth凭据,并且我能够成功地进行API调用以下载报告,但是我必须在customerId中硬编码,因为我不知道如何获取它

API中的的get()方法应该返回客户ID,但要传递给它的参数是什么

我尝试了一个GET请求 不带任何标头参数或正文参数,返回:

 "<html><body>No service was found.</body></html>".

与此不同,我不关心将用户添加到我的MCC帐户。

以下是如何使用googleads python库获取客户ID:

oauth_client = GoogleRefreshTokenClient(environ.get('GOOGLE_CLIENT_ID'), environ.get('GOOGLE_CLIENT_SECRET'), oauth_record.refresh_token)
adwords_client = AdWordsClient(environ.get('ADWORDS_DEVELOPER_TOKEN'),  oauth_client, user_agent='your_user_agent_here')
customer = adwords_client.GetService('CustomerService').get()
customer_id = customer['customerId']
从googleads导入oauth2,adwords
oauth_client=oauth2.GoogleRefreshTokenClient(GOOGLE_client_ID,GOOGLE_client_SECRET,refresh_token)
adwords\u client=adwords.AdWordsClient(adwords\u DEVELOPER\u令牌、oauth\u客户端、用户\u agent='your\u用户\u agent')
customers=adwords\u client.GetService('CustomerService',version='v201809')。getCustomers()
打印(客户['customer_id'])

2020年如何做到这一点?
oauth_client = GoogleRefreshTokenClient(environ.get('GOOGLE_CLIENT_ID'), environ.get('GOOGLE_CLIENT_SECRET'), oauth_record.refresh_token)
adwords_client = AdWordsClient(environ.get('ADWORDS_DEVELOPER_TOKEN'),  oauth_client, user_agent='your_user_agent_here')
customer = adwords_client.GetService('CustomerService').get()
customer_id = customer['customerId']