Browse Source

Increase Cloudflare page size

Increase Cloudflare page size to reduce request count

`GET zones` has a MAX of 50 and a default of 20
https://api.cloudflare.com/#zone-list-zones

`GET zones/:zone_identifier/dns_records` has a MAX of 100 and a default of 20
https://api.cloudflare.com/#dns-records-for-a-zone-list-dns-records
pull/565/head
Lance Hudson 6 years ago
committed by GitHub
parent
commit
90cc9576f5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions
  1. +2
    -2
      octodns/provider/cloudflare.py

+ 2
- 2
octodns/provider/cloudflare.py View File

@ -142,7 +142,7 @@ class CloudflareProvider(BaseProvider):
zones = [] zones = []
while page: while page:
resp = self._try_request('GET', '/zones', resp = self._try_request('GET', '/zones',
params={'page': page})
params={'page': page, 'per_page': 50})
zones += resp['result'] zones += resp['result']
info = resp['result_info'] info = resp['result_info']
if info['count'] > 0 and info['count'] == info['per_page']: if info['count'] > 0 and info['count'] == info['per_page']:
@ -251,7 +251,7 @@ class CloudflareProvider(BaseProvider):
path = '/zones/{}/dns_records'.format(zone_id) path = '/zones/{}/dns_records'.format(zone_id)
page = 1 page = 1
while page: while page:
resp = self._try_request('GET', path, params={'page': page})
resp = self._try_request('GET', path, params={'page': page, 'per_page': 100})
records += resp['result'] records += resp['result']
info = resp['result_info'] info = resp['result_info']
if info['count'] > 0 and info['count'] == info['per_page']: if info['count'] > 0 and info['count'] == info['per_page']:


Loading…
Cancel
Save