Hello Fahima,

Thank you for reaching out to us.

Looking on the error encountered, you would need to enable the Google Ads API 
in your project. You can check on this guide for more details.

As an aside, I will be removing your original post as it contains Google Cloud 
project information. Please refrain from sharing these information in the forum 
thread. Below is a copy of your post with the masked details.

I'm trying to run the following script

import argparse
import sys

from google.ads.googleads.client import GoogleAdsClient

from google.ads.googleads.errors import GoogleAdsException

def main(client, customer_id):

ga_service = client.get_service("GoogleAdsService")

query = """

SELECT
campaign.id,
campaign.name
FROM campaign
ORDER BY campaign.id"""

# Issues a search request using streaming.

stream = ga_service.search_stream(customer_id=customer_id, query=query)

for batch in stream:

for row in batch.results:

print(

f"Campaign with ID {row.campaign.id} and name "

f'"{row.campaign.name}" was found.'

)

if __name__ == "__main__":

# GoogleAdsClient will read the google-ads.yaml configuration file in the
# home directory if none is specified.

googleads_client = GoogleAdsClient.load_from_storage(version="v8")

parser = argparse.ArgumentParser(
description="Lists all campaigns for specified customer."
)

# The following argument(s) should be provided to run the example.

parser.add_argument(
"-c",
"--customer_id",
type=str,
required=True,
help="The Google Ads customer ID.",
)

args = parser.parse_args()

try:
main(googleads_client, args.customer_id)
except GoogleAdsException as ex:

print(

f'Request with ID "{ex.request_id}" failed with status '

f'"{ex.error.code().name}" and includes the following errors:'
)

for error in ex.failure.errors:

print(f'\tError with message "{error.message}".')

if error.location:

for field_path_element in error.location.field_path_elements:

print(f"\t\tOn field: {field_path_element.field_name}")

sys.exit(1)

For the "customer_id" I'm plugging in the client customer ID that was provided 
with my adwords credentials, it's formatted as "###=###=####"

I keep receiving the following error
google.api_core.exceptions.PermissionDenied: 403 Google Ads API has not been 
used in project ###### before or it is disabled. Enable it by visiting <Google 
Cloud link> then retry. If you enabled this API recently, wait a few minutes 
for the action to propagate to our systems and retry.
I've reached out to the owner of the manager account and he's unable to change 
the permissions. Can you please assist?

Regards,

Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 
Google Ads API and AdWords API Annual Survey

Mark Kevin Albios
Google Ads API Team
ref:_00D1U1174p._5004Q2R7IvX:ref

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/Q07VP000000000000000000000000000000000000000000000R2AI2X00kQD8NWvnQIu2Fl9s6HLPLw%40sfdc.net.
  • Ad... Fahima Hyder
    • ... 'Google Ads API Forum Advisor' via AdWords API and Google Ads API Forum

Reply via email to