Skip to content

Commit

Permalink
fixed paging examples, as per pull request cloudflare#28 & cloudflare#29
Browse files Browse the repository at this point in the history
  • Loading branch information
mahtin committed Aug 22, 2017
1 parent 152c9a1 commit fb12f30
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/example_paging_thru_zones.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def main():

page_number = 0
while True:
page_number += 1
try:
raw_results = cf.zones.get(params={'per_page':5,'page':page_number})
except CloudFlare.exceptions.CloudFlareAPIError as e:
Expand All @@ -34,7 +35,6 @@ def main():

if page_number == total_pages:
break
page_number += 1

if __name__ == '__main__':
main()
Expand Down
5 changes: 2 additions & 3 deletions examples/example_paging_thru_zones.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ PAGE_NUMBER=0

while true
do
# grab the next page
PAGE_NUMBER=`expr ${PAGE_NUMBER} + 1`
cli4 --raw per_page=5 page=${PAGE_NUMBER} /zones > ${tmp}

domains=`jq -c '.|.result|.[]|.name' < ${tmp} | tr -d '"'`
Expand All @@ -25,8 +27,5 @@ do
## last section
break
fi

# grab the next page
PAGE_NUMBER=`expr ${PAGE_NUMBER} + 1`
done

0 comments on commit fb12f30

Please sign in to comment.