Skip to content

Commit 71d9c6c

Browse files
authored
Normalize datatypes of IDs in get_account_hierarchy example (googleads#394)
1 parent 589952a commit 71d9c6c

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

examples/account_management/get_account_hierarchy.py

100644100755
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ def main(client, login_customer_id=None):
9090
root_customer_client = None
9191

9292
while unprocessed_customer_ids:
93-
customer_id = unprocessed_customer_ids.pop(0)
93+
customer_id = int(unprocessed_customer_ids.pop(0))
9494
response = googleads_service.search(
9595
customer_id=str(customer_id), query=query
9696
)
@@ -123,8 +123,7 @@ def main(client, login_customer_id=None):
123123
# prevent visiting the same customer many times, we
124124
# need to check if it's already in the Dictionary.
125125
if (
126-
customer_client.id
127-
not in customer_ids_to_child_accounts
126+
customer_client.id not in customer_ids_to_child_accounts
128127
and customer_client.level == 1
129128
):
130129
unprocessed_customer_ids.append(customer_client.id)
@@ -145,7 +144,6 @@ def main(client, login_customer_id=None):
145144
)
146145

147146

148-
149147
def _print_account_hierarchy(
150148
customer_client, customer_ids_to_child_accounts, depth
151149
):
@@ -162,7 +160,7 @@ def _print_account_hierarchy(
162160
if depth == 0:
163161
print("Customer ID (Descriptive Name, Currency Code, Time Zone)")
164162

165-
customer_id = str(customer_client.id)
163+
customer_id = customer_client.id
166164
print("-" * (depth * 2), end="")
167165
print(
168166
f"{customer_id} ({customer_client.descriptive_name}, "

0 commit comments

Comments
 (0)