Skip to content
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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/account_management/get_account_hierarchy.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def main(client, login_customer_id=None):
unprocessed_customer_ids = [seed_customer_id]
customer_ids_to_child_accounts = dict()
root_customer_client = None

# 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)
Copy link
Contributor

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

googleads_service = client.get_service("GoogleAdsService")
Copy link
Contributor

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"]


while unprocessed_customer_ids:
customer_id = int(unprocessed_customer_ids.pop(0))
Expand Down