Hi,
I have a MCC account with a Basic Access developer token.
I can successfuly create objects such as the following:
from googleads import adwords
import logging
adwords_client = adwords.AdWordsClient.LoadFromStorage()
adwords_client
Out[59]: <googleads.adwords.AdWordsClient at 0xabfbe70>
This is my googlead.yaml file:
adwords:
developer_token: my MCC developer token
user_agent: Adwords Manager
client_customer_id: Adwords ID of the MCC account
client_id: The client_id in the Google Console credentials for my project
client_secret: the client secret in the Google Console credentials for my project
refresh_token: the refresh token used when running generate_refresh_token.py from the command line and retrieving the code by using an Icognito tab and signing in to retrieve the refresh token with my MCC administrator email address and password.
However, when i try to retrieve data via the API, I receive the following error:
WebFault: Server raised fault: '[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:'<null>']'
I have included an example script below the body text, down to the line that throws the error. Could you please help me understand what else is needed to successfully execute queries to the API?
from googleads import adwords
PAGE_SIZE = 500
def DisplayAccountTree(account, accounts, links, depth=0):
"""Displays an account tree.
Args:
account: dict The account to display.
accounts: dict Map from customerId to account.
links: dict Map from customerId to child links.
depth: int Depth of the current account in the tree.
"""
prefix = '-' * depth * 2
print '%s%s, %s' % (prefix, account['customerId'], account['name'])
if account['customerId'] in links:
for child_link in links[account['customerId']]:
child_account = accounts[child_link['clientCustomerId']]
DisplayAccountTree(child_account, accounts, links, depth + 1)
def main(client):
# Initialize appropriate service.
managed_customer_service = client.GetService(
'ManagedCustomerService', version='v201603')
# Construct selector to get all accounts.
offset = 0
selector = {
'fields': ['CustomerId', 'Name'],
'paging': {
'startIndex': str(offset),
'numberResults': str(PAGE_SIZE)
}
}
more_pages = True
accounts = {}
child_links = {}
parent_links = {}
root_account = None
while more_pages:
# Get serviced account graph.
page = managed_customer_service.get(selector)