Google Ads API Python Client Library Pagination

266 views
Skip to first unread message

dmitrii....@omio.com

unread,
Apr 5, 2019, 11:13:47 AM4/5/19
to AdWords API and Google Ads API Forum
Hello,

I use a python client library for Google Ads API.

I need to show to a user a result of an arbitrary GAQL query with 50 elements per page pagination.

For example I have this query:

SELECT campaign.id
FROM campaign
LIMIT
51

And this code to fetch the results:

client = google.ads.google_ads.client.GoogleAdsClient .load_from_storage()
google_ads_service = client.get_service('GoogleAdsService', version='v1')
return google_ads_service.search(customer_id, query, page_size=50)

But `google_ads_sevice` returns me 51 elements without next_page_token.

I can not also paginate using the query, because there is no "SKIP".

How should I paginate with the Python Google Ads Client Library?

Kind regards,
  Dmitrii.

googleadsapi...@google.com

unread,
Apr 5, 2019, 4:53:24 PM4/5/19
to AdWords API and Google Ads API Forum
Hello Dimitri,

When you specify the page limit as 50 only 50 elements will be displayed per page even though the LIMIT mentioned is 51. I tried the same scenario at my end and I was able to get the 51th row in second page. If you are still facing the issue, please raise an issue in our client library with the code snippet, our client library owners are better equipped to answer this.

Regards,
Sai Teja, Google Ads API Team

=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

Was your question answered? Please rate your experience with us by taking a short survey.
If not -- reply to this email and tell us what else we can do to help.

Take Survey

Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com/search/label/adwords_api
https://developers.google.com/adwords/api/community/

dmitrii....@omio.com

unread,
Apr 8, 2019, 3:23:34 AM4/8/19
to AdWords API and Google Ads API Forum
Hello Sai,

Thank you for your response.

Kind regards,
  Dmitrii.

googleadsapi...@google.com

unread,
Apr 8, 2019, 11:40:58 AM4/8/19
to AdWords API and Google Ads API Forum
Hello Dimitri,

Thanks for creating the issue. Someone from our team will follow up with you on that issue soon.


Regards,
Sai Teja, Google Ads API Team


=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
    https://ads-developers.googleblog.com/search/label/google_ads_api
    https://developers.google.com/adwords/api/community/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Reply all
Reply to author
Forward
0 new messages