Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit c842b04

Browse files
authored
Fix Pagination in example raw code
Page 0 is the same as page 1. And the way that the page is incremented just before the check to see if you are at the final page causes the loop to exit early. By incrementing at the beginning of the loop you get all pages of data and don't miss the last page.
1 parent 5358208 commit c842b04

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ def main():
103103
cf = CloudFlare.CloudFlare(raw=True)
104104
page_number = 0
105105
while True:
106+
page_number += 1
106107
raw_results = cf.zones.get(params={'per_page':5,'page':page_number})
107108
zones = raw_results['result']
108109

@@ -112,7 +113,6 @@ def main():
112113
print zone_id, zone_name
113114

114115
total_pages = raw_results['result_info']['total_pages']
115-
page_number += 1
116116
if page_number == total_pages:
117117
break
118118

0 commit comments

Comments
 (0)