Hey everyone,

I've tested several different solutions but none of them seems to be the 
right answer, In essence I'm afer the following:

  SELECT
    customer.id,
    metrics.conversions,
    metrics.conversions_value,
    segments.conversion_action,
    segments.conversion_action_name
  FROM customer

I'm using an mcc login in this particular case. Here's what I've tried so 
far:

credentials = Credentials(
    None,
    refresh_token="**refresh_token**",
    token_uri="**uri**",
    client_id="**client_id**",
    client_secret="**client_secret**",
)
client= GoogleAdsClient(
    credentials,
    login_customer_id = '**login_customer_id**',
    developer_token="**developer_token",
)
service = client.get_service("GoogleAdsService", 'v6')
response = ga_service.search_stream(customer_id=client.login_customer_id, 
query=query)
for batch in response:
    for row in batch.results:
        logger.debug(row)

Which(understandably) returns an error: 

    ...*errors { error_code { query_error: REQUESTED_METRICS_FOR_MANAGER } 
message: "Metrics cannot be requested for a manager account. To retrieve 
metrics, issue separate requests against each client account under the 
manager account." }...*

So with that, I decided to go over each of the accessible customers:

ee = []
rr = []

client_ids = client.get_service(
    'CustomerService',
    version='v6',
).list_accessible_customers().resource_names
for client_id in client_ids:
    client_id = client_id.split('/')[1]
    logger.debug(client_id)
    try:
        results = iter(
            service.search_stream(client_id, query),
        )
    except Exception as e:
        ee.append(e)
        continue
    for xxx in results:
        rr.append(xxx)

In which case all the requests fail with the following error:

Request made: ClientCustomerId: *****, Host: googleads.googleapis.com:443, 
Method: /google.ads.googleads.v6.services.GoogleAdsService/SearchStream, 
RequestId: ****, IsFault: True, FaultMessage: Metrics cannot be requested 
for a manager account. To retrieve metrics, issue separate requests against 
each client account under the manager account.

All except for one, the one being the manager account itself, which fails 
with the first error. So The question is what am I doing wrong here?

Kind regards,
Alex.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API and Google Ads API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/00a3a583-f607-470d-a0cb-141136794c04n%40googlegroups.com.

Reply via email to