Please dont forget to reply this
On Wednesday, July 20, 2022 at 3:55:45 PM UTC-3 Jose Luis Petracca wrote:
> Hi,
>
> I am trying to get data form the api, it is a really simple request, that
> is an example from the package
>
> *System information:*
>
> - python 3.9.9
> - package version google-ads==17.0.0
> - using service account
>
>
> *The Code*
>
>
> from google.ads.googleads.client import GoogleAdsClient
> from google.ads.googleads.errors import GoogleAdsException
>
> credentials = {
> "developer_token": "devELOPERTOkeen",
> "json_key_file_path" : PATH_TO_SERVICE_ACCOUNT_JSON,
> "impersonated_email":"[email protected]
> <https://groups.google.com/>",
> "use_proto_plus": True,
> 'login_customer_id' : '1111111122' #MMC ID
> }
>
> googleads_client = GoogleAdsClient.load_from_dict(credentials)
>
>
> def stream_response(client, customer_id, query):
> return
> client.get_service("GoogleAdsService").search_stream(customer_id,
> query=query)
>
> def main(client, customer_id):
> query = "SELECT campaign.name FROM campaign LIMIT 10"
> response = stream_response(client, customer_id, query=query)
> for batch in response:
> print(batch)
>
>
> customer_id = '1223334445'
> main(googleads_client, customer_id)
>
> *The Response /error*
> GoogleAdsException: (<_SingleThreadedRendezvous of RPC that terminated
> with: status = StatusCode.UNAUTHENTICATED details = "Request is
> missing required authentication credential. Expected OAuth 2 access token,
> login cookie or other valid authentication credential. See
> https://developers.google.com/identity/sign-in/web/devconsole-project."
> debug_error_string =
> "{"created":"@1658341926.845702000","description":"Error received from peer
> ipv6:[2800:3f0:4002:80c::200a]:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Request
>
> is missing required authentication credential. Expected OAuth 2 access
> token, login cookie or other valid authentication credential. See
> https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
> >,
> <_SingleThreadedRendezvous of RPC that terminated with: status =
> StatusCode.UNAUTHENTICATED details = "Request is missing required
> authentication credential. Expected OAuth 2 access token, login cookie or
> other valid authentication credential. See
> https://developers.google.com/identity/sign-in/web/devconsole-project."
> debug_error_string =
> "{"created":"@1658341926.845702000","description":"Error received from peer
> ipv6:[2800:3f0:4002:80c::200a]:443","file":"src/core/lib/surface/call.cc","file_line":967,"grpc_message":"Request
>
> is missing required authentication credential. Expected OAuth 2 access
> token, login cookie or other valid authentication credential. See
> https://developers.google.com/identity/sign-in/web/devconsole-project.","grpc_status":16}"
> >,
> errors { error_code { authentication_error: NOT_ADS_USER } message: "User
> in the cookie is not a valid Ads user." } request_id:
> "8ykzEeM7wVjZoJ1VDI54aw" , '8ykzEeM7wVjZoJ1VDI54aw')
>
>
>
>
> Using service account is mandatory. Anyone knows what i am doing wrong?
>
> Regards
> Jose Luis
>
>
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
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
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/adwords-api/ad55d6b0-c7ae-4234-8800-624968349e75n%40googlegroups.com.