I have created audience through python
api(https://github.com/googleads/google-ads-python/blob/720b39e3538f65d1cc48ce1e92479154cfa2fc23/examples/remarketing/add_custom_audience.py)
, 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
audience.id,
audience.name
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
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/7251069f-91f7-48e3-8836-47da8aa29d96n%40googlegroups.com.