-
Notifications
You must be signed in to change notification settings - Fork 480
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix in get_account_hierarchy #522
base: main
Are you sure you want to change the base?
Conversation
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed (or fixed any issues), please reply here with What to do if you already signed the CLAIndividual signers
Corporate signers
ℹ️ Googlers: Go here for more info. |
@googlebot I signed it! |
|
||
# login_customer_id is required to query child accounts that are not | ||
# directly accessible to the OAuth Credentials | ||
client.login_customer_id = str(seed_customer_id) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to convert this to a str
as it's already defined as such by argparse here
# login_customer_id is required to query child accounts that are not | ||
# directly accessible to the OAuth Credentials | ||
client.login_customer_id = str(seed_customer_id) | ||
googleads_service = client.get_service("GoogleAdsService") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like the first googleads_service
initialization on line 43 can be removed, then line 79 can be updated to use customer service:
customer_id = customer_service.parse_customer_path(
customer_resource_name
)["customer_id"]
The changes here fixed the example for me. Previously, I was getting "User doesn't have permission to access customer." The final patched code: for seed_customer_id in seed_customer_ids:
client.login_customer_id = seed_customer_id
googleads_service = client.get_service("GoogleAdsService") using @BenRKarl's suggested change as well ( |
I had the same error mentionned in #441 using code based on
examples/account_management/get_account_hierarchy.py
.The error occurs in the
client.get_service("GoogleAdsService").search
method because the client doesn't have alogin_customer_id
.Assigning the seed_customer_id (which is part of the accessible customers) to
GoogleAdsClient
that generatesGoogleAdsService
worked for me.