) , and it was successful, I got the the resource name as a response. But when I am trying to fetch all audiences I am getting empty list. I am using following query to get audience list:
import argparse
import sys
from google.ads.googleads.client import GoogleAdsClient
from google.ads.googleads.errors import GoogleAdsException
def main(client, customer_id):
# Get the GoogleAdsService client.
googleads_service = client.get_service("GoogleAdsService")
query = f"""
SELECT
FROM audience
"""
search_response = googleads_service.search(
customer_id=customer_id, query=query
)
print(search_response)
for res in search_response:
print(res)
if __name__ == "__main__":
googleads_client = GoogleAdsClient.load_from_storage(version="v15")
parser = argparse.ArgumentParser(
description="Updates the audience target restriction of a given ad "
"group to bid only."
)
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)
Thank You