raw mode for paginated requests not working for me
iojeda opened this issue · 3 comments
First of all thanks for your work in this wrapper it makes interacting with Cloudflare easier.
I am having an issue when trying to paginate, please see below screenshot of debugmode for a raw paginated dns request
As you can see I defined 500 results per page but I am only getting 100 per page.
Also on second iteration of the loop I still get the 1st page although I am requesting the second page.
Is there something wrong in my code?
Could you please point me in the right direction?
I apologize in case this is not the place to raise this kind of questions but I don't know anywhere else to ask.
Thanks in advance.
Hi I figured out what was the issue 🤦♂️.
In my code (line 30) I was using cf.zones.dns_records instead of cf.zones.dns_records.get
So working code for line 30 is:
raw_results = cf.zones.dns_records.get(zoneid,params={'per_page':500,'page':page_number})
Hope this helps someone else 😄
@iojeda - I'm glad you have working code; however, I can actually see why this failed for you. There's a typo in the code (that was introduced recently). I will go add a fix quickly. The .get()
form is the best way to to code; however these two calls should be the same (once the bug is fixed):
r = cf.zones.dns_records(zone_id, params=...)
r = cf.zones.dns_records.get(zone_id, params=...)
Sorry! Stay tuned.
OK - fixed. Release 2.9.10
onto (PyPI)[https://pypi.org/project/cloudflare/] and here on GitHub. You can now call with or without the .get
again.