Hello,
When trying to retrieve the total number of rows in a report via
num_results (or total_results_count, which is listed on the documentation
but doesn't seem to exist), 0 is returned despite there being results in
the report that I am then able to iterate through and
return_total_results_count being set to True. The only way I can get it to
return an accurate number is by iterating through the rows and then
retrieving num_results. Example code below:
ga_service = client.get_service("GoogleAdsService", version="v5")
query = """SELECT segments.date,
campaign.name,
search_term_view.search_term,
metrics.impressions
FROM search_term_view
WHERE segments.date BETWEEN '20201016' AND '20201016'
ORDER BY segments.date ASC"""
search_term_report =
ga_service.search(customer_id, query=query, return_total_results_count=True)
print(search_term_report.num_results)
>0
for row in search_term_report:
#nothing
print(search_term_report.num_results)
> 5
Thanks,
Leo
--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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
"AdWords API and Google Ads 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/3e80d952-af87-42e7-a4b2-10b4d192ee20n%40googlegroups.com.