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)