Python 如何仅使用客户ID链接Google Adwords API中的帐户?
我很难理解谷歌的API文档,希望能在这里得到一些帮助 对我来说,作为一个全新的开发者,GoogleAPI文档毫无意义 我正在使用google adwords Python库,这段代码可能很有用:。但是,我需要通过发出邀请并将其标记为挂起来链接一个已经存在的帐户。我不想创建一个新帐户Python 如何仅使用客户ID链接Google Adwords API中的帐户?,python,google-ads-api,Python,Google Ads Api,我很难理解谷歌的API文档,希望能在这里得到一些帮助 对我来说,作为一个全新的开发者,GoogleAPI文档毫无意义 我正在使用google adwords Python库,这段代码可能很有用:。但是,我需要通过发出邀请并将其标记为挂起来链接一个已经存在的帐户。我不想创建一个新帐户 那么,我从哪里开始用Python编写它呢?我不理解文档,只需要根据给定的客户ID创建一个帐户。任何提示和窍门都会很棒 要将现有帐户链接到您的MCC帐户,您还需要使用ManagedCustomerService,特别是
那么,我从哪里开始用Python编写它呢?我不理解文档,只需要根据给定的客户ID创建一个帐户。任何提示和窍门都会很棒 要将现有帐户链接到您的MCC帐户,您还需要使用
ManagedCustomerService
,特别是mutateLink
方法。
在Python中,它看起来像这样:
# Create the service object
managed_customer_service = client.GetService('ManagedCustomerService', version='v201605')
# Construct the operation, operator "ADD" and status "PENDING" results in a new invitation
operation = {
'operator': 'ADD',
'operand': {
'managerCustomerId': YOUR_MCC_ACCOUNT_ID,
'clientCustomerId': ACCOUNT_ID_TO_BE_INVITED,
'linkStatus': 'PENDING',
'pendingDescriptiveName': 'Some text that helps identifying the invitation',
'isHidden': False # This can be used to hide the account in your MCC to decrease clutter
}
}
# Send the operation
response = managed_customer_service.mutateLink([operation])
# Print out the resulting ManagedCustomerLink
pprint.pprint(response.links[0])
请注意,我没有测试这段代码,但它应该能让您大致了解它是如何工作的。有关更多详细信息以及在客户端帐户接受邀请后如何继续操作的信息,请参阅。Python(桌面)应用程序中的Ads?不,我只希望能够使用命令ping bot以链接帐户。真像!命令并发送一个挂起的邀请@利努斯