Is there a more efficient way to get all the customer names and currency codes for the logged in user using google ads api?
customer_service = client.get_service("CustomerService") app_list = customer_service.list_accessible_customers().resource_names def customer_query(client, customer_id): ga_service = client.get_service("GoogleAdsService") query = """ SELECT customer.descriptive_name, customer.currency_code FROM customer LIMIT 1""" request = client.get_type("SearchGoogleAdsRequest") request.customer_id = customer_id request.query = query response = ga_service.search(request=request) customer = list(response)[0].customer return customer for entry in app_list: customer_id = entry.split('/')[1] entry = customer_query(client, customer_id) formatted_entry = {'customer_id': customer_id, 'name': entry.descriptive_name, 'currency': entry.currency_code} apps.append(formatted_entry) return apps
This seems really convoluted and I'm having to pass around a lot more data than I'd like. Surely there should be a way to just request the details.