customer not enabled error

31 views
Skip to first unread message

INI GlobalOps

unread,
Oct 13, 2021, 12:28:15 PM10/13/21
to AdWords API and Google Ads API Forum
Hi, we when generating reports by iterating over a list of customers, sometimes we get an error when a customer is not enabled which stops the process.

What is the best way or endpoint to check for that?

So we can implement code like this

if customer.is_enabled == False then skip

Thank you!

Google Ads API Forum Advisor

unread,
Oct 14, 2021, 11:37:27 AM10/14/21
to adwor...@googlegroups.com
Hello,

Thanks for reaching out. The best way to handle this scenario is to enable partial failure. Setting partialFailure to true will allow you to handle failed operations separately at the end without abruptly ending your request. 

Regards,
Matt
Google Ads API Team

Google Logo
Matt
Google Ads API Team
 


ref:_00D1U1174p._5004Q2PJJ2i:ref

INI GlobalOps

unread,
Oct 20, 2021, 5:18:57 PM10/20/21
to AdWords API and Google Ads API Forum
Thanks Matt - follow up question - the docs you linked state that partial_failure method isn't available for get requests -

Is there something we can use for get requests?

That's all we are doing is get requests - getting a daily list of accounts, then their ad performance reports like this:

def get_batch_list(customer_id, query):
message = "getting batch list for " + str(customer_id)
logger(message)
response = ga_service.search_stream(request = None,
customer_id = str(customer_id),
query = query)
batch_list = []
try:
for batch in response:
message = str(len(batch.results)) + " items found"
logger(message)
batch_list.append(batch.results)
return batch_list
except google.ads.google_ads.errors.GoogleAdsException as ex:
logger('Request with ID "%s" failed with status "%s" and includes the '
'following errors:' % (ex.request_id, ex.error.code().name))
for error in ex.failure.errors:
logger('\tError with message "%s".' % error.message)
if error.location:
for field_path_element in error.location.field_path_elements:
logger('\t\tOn field: %s' % field_path_element.field_name)
sys.exit(1)


Thanks!

Google Ads API Forum Advisor

unread,
Oct 21, 2021, 11:16:04 AM10/21/21
to adwor...@googlegroups.com
Hello,

The parital_failure field is only available for mutate methods. In general, it's recommended that get requests are not used in a production environment, as there is a 1,000 request limit for all access types. You can read more on inspecting objects here. The GoogleAdsService Search and SearchStream methods are recommended for retrieving data instead. 
Reply all
Reply to author
Forward
0 new messages