We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Cloudflare provider only lists first DNS 100 entries for domain
How to reproduce:

* Have a CloudFlare domain with > 100 entries
* Create a new entry starting with a "high" letter, e.g. `zzzz.<domain>`
* List entries: only the first 100 entries will be returned, making it appear as though `zzzz` had not been created.


```
    def _list_records(self, rtype=None, name=None, content=None):
        filter_obj = {'per_page': 100}      ####### NOTE
        if rtype:
            filter_obj['type'] = rtype
        if name:
            filter_obj['name'] = self._full_name(name)
        if content:
            filter_obj['content'] = content

        payload = self._get(
            '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)   
           ### subsequent pages not retrieved

        records = []
        for record in payload['result']:
            processed_record = {
                'type': record['type'],
                'name': record['name'],
                'ttl': record['ttl'],
                'content': record['content'],
                'id': record['id']
            }
            records.append(processed_record)

        LOGGER.debug('list_records: %s', records)
        return records
```

This causes weird errors whereby an existing entry is not returned if falls after the 100th entry.

Without specifying the "per page" parameter, only the first 20 entries are returned.

Besides a quick-n-dirty solution of raising that number to e.g. 1000, the proper solution would be to implement proper pagination support for the _get method.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `lexicon/providers/cloudflare.py`
Content:
```
1 """Module provider for Cloudflare"""
2 from __future__ import absolute_import
3 import json
4 import logging
5 
6 import requests
7 from lexicon.providers.base import Provider as BaseProvider
8 
9 
10 LOGGER = logging.getLogger(__name__)
11 
12 NAMESERVER_DOMAINS = ['cloudflare.com']
13 
14 
15 def provider_parser(subparser):
16     """Return the parser for this provider"""
17     subparser.add_argument(
18         "--auth-username", help="specify email address for authentication")
19     subparser.add_argument(
20         "--auth-token", help="specify token for authentication")
21 
22 
23 class Provider(BaseProvider):
24     """Provider class for Cloudflare"""
25     def __init__(self, config):
26         super(Provider, self).__init__(config)
27         self.domain_id = None
28         self.api_endpoint = 'https://api.cloudflare.com/client/v4'
29 
30     def _authenticate(self):
31 
32         payload = self._get('/zones', {
33             'name': self.domain,
34             'status': 'active'
35         })
36 
37         if not payload['result']:
38             raise Exception('No domain found')
39         if len(payload['result']) > 1:
40             raise Exception('Too many domains found. This should not happen')
41 
42         self.domain_id = payload['result'][0]['id']
43 
44     # Create record. If record already exists with the same content, do nothing'
45 
46     def _create_record(self, rtype, name, content):
47         data = {'type': rtype, 'name': self._full_name(
48             name), 'content': content}
49         if self._get_lexicon_option('ttl'):
50             data['ttl'] = self._get_lexicon_option('ttl')
51 
52         payload = {'success': True}
53         try:
54             payload = self._post(
55                 '/zones/{0}/dns_records'.format(self.domain_id), data)
56         except requests.exceptions.HTTPError as err:
57             already_exists = next((True for error in err.response.json()[
58                 'errors'] if error['code'] == 81057), False)
59             if not already_exists:
60                 raise
61 
62         LOGGER.debug('create_record: %s', payload['success'])
63         return payload['success']
64 
65     # List all records. Return an empty list if no records found
66     # type, name and content are used to filter records.
67     # If possible filter during the query, otherwise filter after response is received.
68     def _list_records(self, rtype=None, name=None, content=None):
69         filter_obj = {'per_page': 100}
70         if rtype:
71             filter_obj['type'] = rtype
72         if name:
73             filter_obj['name'] = self._full_name(name)
74         if content:
75             filter_obj['content'] = content
76 
77         payload = self._get(
78             '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)
79 
80         records = []
81         for record in payload['result']:
82             processed_record = {
83                 'type': record['type'],
84                 'name': record['name'],
85                 'ttl': record['ttl'],
86                 'content': record['content'],
87                 'id': record['id']
88             }
89             records.append(processed_record)
90 
91         LOGGER.debug('list_records: %s', records)
92         return records
93 
94     # Create or update a record.
95     def _update_record(self, identifier, rtype=None, name=None, content=None):
96 
97         data = {}
98         if rtype:
99             data['type'] = rtype
100         if name:
101             data['name'] = self._full_name(name)
102         if content:
103             data['content'] = content
104         if self._get_lexicon_option('ttl'):
105             data['ttl'] = self._get_lexicon_option('ttl')
106 
107         payload = self._put(
108             '/zones/{0}/dns_records/{1}'.format(self.domain_id, identifier), data)
109 
110         LOGGER.debug('update_record: %s', payload['success'])
111         return payload['success']
112 
113     # Delete an existing record.
114     # If record does not exist, do nothing.
115     def _delete_record(self, identifier=None, rtype=None, name=None, content=None):
116         delete_record_id = []
117         if not identifier:
118             records = self._list_records(rtype, name, content)
119             delete_record_id = [record['id'] for record in records]
120         else:
121             delete_record_id.append(identifier)
122 
123         LOGGER.debug('delete_records: %s', delete_record_id)
124 
125         for record_id in delete_record_id:
126             self._delete(
127                 '/zones/{0}/dns_records/{1}'.format(self.domain_id, record_id))
128 
129         LOGGER.debug('delete_record: %s', True)
130         return True
131 
132     # Helpers
133     def _request(self, action='GET', url='/', data=None, query_params=None):
134         if data is None:
135             data = {}
136         if query_params is None:
137             query_params = {}
138         response = requests.request(action, self.api_endpoint + url, params=query_params,
139                                     data=json.dumps(data),
140                                     headers={
141                                         'X-Auth-Email': self._get_provider_option('auth_username'),
142                                         'X-Auth-Key': self._get_provider_option('auth_token'),
143                                         'Content-Type': 'application/json'
144                                     })
145         # if the request fails for any reason, throw an error.
146         response.raise_for_status()
147         return response.json()
148
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/lexicon/providers/cloudflare.py b/lexicon/providers/cloudflare.py
--- a/lexicon/providers/cloudflare.py
+++ b/lexicon/providers/cloudflare.py
@@ -74,21 +74,31 @@
         if content:
             filter_obj['content'] = content
 
-        payload = self._get(
-            '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)
-
         records = []
-        for record in payload['result']:
-            processed_record = {
-                'type': record['type'],
-                'name': record['name'],
-                'ttl': record['ttl'],
-                'content': record['content'],
-                'id': record['id']
-            }
-            records.append(processed_record)
+        while True:
+            payload = self._get(
+                '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)
+
+            LOGGER.debug("payload: %s", payload)
+
+            for record in payload['result']:
+                processed_record = {
+                    'type': record['type'],
+                    'name': record['name'],
+                    'ttl': record['ttl'],
+                    'content': record['content'],
+                    'id': record['id']
+                }
+                records.append(processed_record)
+
+            pages = payload['result_info']['total_pages']
+            page = payload['result_info']['page']
+            if page >= pages:
+                break
+            filter_obj['page'] = page + 1
 
         LOGGER.debug('list_records: %s', records)
+        LOGGER.debug('Number of records retrieved: %d', len(records))
         return records
 
     # Create or update a record.

{"golden_diff": "diff --git a/lexicon/providers/cloudflare.py b/lexicon/providers/cloudflare.py\n--- a/lexicon/providers/cloudflare.py\n+++ b/lexicon/providers/cloudflare.py\n@@ -74,21 +74,31 @@\n         if content:\n             filter_obj['content'] = content\n \n-        payload = self._get(\n-            '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)\n-\n         records = []\n-        for record in payload['result']:\n-            processed_record = {\n-                'type': record['type'],\n-                'name': record['name'],\n-                'ttl': record['ttl'],\n-                'content': record['content'],\n-                'id': record['id']\n-            }\n-            records.append(processed_record)\n+        while True:\n+            payload = self._get(\n+                '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)\n+\n+            LOGGER.debug(\"payload: %s\", payload)\n+\n+            for record in payload['result']:\n+                processed_record = {\n+                    'type': record['type'],\n+                    'name': record['name'],\n+                    'ttl': record['ttl'],\n+                    'content': record['content'],\n+                    'id': record['id']\n+                }\n+                records.append(processed_record)\n+\n+            pages = payload['result_info']['total_pages']\n+            page = payload['result_info']['page']\n+            if page >= pages:\n+                break\n+            filter_obj['page'] = page + 1\n \n         LOGGER.debug('list_records: %s', records)\n+        LOGGER.debug('Number of records retrieved: %d', len(records))\n         return records\n \n     # Create or update a record.\n", "issue": "Cloudflare provider only lists first DNS 100 entries for domain\nHow to reproduce:\r\n\r\n* Have a CloudFlare domain with > 100 entries\r\n* Create a new entry starting with a \"high\" letter, e.g. `zzzz.<domain>`\r\n* List entries: only the first 100 entries will be returned, making it appear as though `zzzz` had not been created.\r\n\r\n\r\n```\r\n    def _list_records(self, rtype=None, name=None, content=None):\r\n        filter_obj = {'per_page': 100}      ####### NOTE\r\n        if rtype:\r\n            filter_obj['type'] = rtype\r\n        if name:\r\n            filter_obj['name'] = self._full_name(name)\r\n        if content:\r\n            filter_obj['content'] = content\r\n\r\n        payload = self._get(\r\n            '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)   \r\n           ### subsequent pages not retrieved\r\n\r\n        records = []\r\n        for record in payload['result']:\r\n            processed_record = {\r\n                'type': record['type'],\r\n                'name': record['name'],\r\n                'ttl': record['ttl'],\r\n                'content': record['content'],\r\n                'id': record['id']\r\n            }\r\n            records.append(processed_record)\r\n\r\n        LOGGER.debug('list_records: %s', records)\r\n        return records\r\n```\r\n\r\nThis causes weird errors whereby an existing entry is not returned if falls after the 100th entry.\r\n\r\nWithout specifying the \"per page\" parameter, only the first 20 entries are returned.\r\n\r\nBesides a quick-n-dirty solution of raising that number to e.g. 1000, the proper solution would be to implement proper pagination support for the _get method.\n", "before_files": [{"content": "\"\"\"Module provider for Cloudflare\"\"\"\nfrom __future__ import absolute_import\nimport json\nimport logging\n\nimport requests\nfrom lexicon.providers.base import Provider as BaseProvider\n\n\nLOGGER = logging.getLogger(__name__)\n\nNAMESERVER_DOMAINS = ['cloudflare.com']\n\n\ndef provider_parser(subparser):\n    \"\"\"Return the parser for this provider\"\"\"\n    subparser.add_argument(\n        \"--auth-username\", help=\"specify email address for authentication\")\n    subparser.add_argument(\n        \"--auth-token\", help=\"specify token for authentication\")\n\n\nclass Provider(BaseProvider):\n    \"\"\"Provider class for Cloudflare\"\"\"\n    def __init__(self, config):\n        super(Provider, self).__init__(config)\n        self.domain_id = None\n        self.api_endpoint = 'https://api.cloudflare.com/client/v4'\n\n    def _authenticate(self):\n\n        payload = self._get('/zones', {\n            'name': self.domain,\n            'status': 'active'\n        })\n\n        if not payload['result']:\n            raise Exception('No domain found')\n        if len(payload['result']) > 1:\n            raise Exception('Too many domains found. This should not happen')\n\n        self.domain_id = payload['result'][0]['id']\n\n    # Create record. If record already exists with the same content, do nothing'\n\n    def _create_record(self, rtype, name, content):\n        data = {'type': rtype, 'name': self._full_name(\n            name), 'content': content}\n        if self._get_lexicon_option('ttl'):\n            data['ttl'] = self._get_lexicon_option('ttl')\n\n        payload = {'success': True}\n        try:\n            payload = self._post(\n                '/zones/{0}/dns_records'.format(self.domain_id), data)\n        except requests.exceptions.HTTPError as err:\n            already_exists = next((True for error in err.response.json()[\n                'errors'] if error['code'] == 81057), False)\n            if not already_exists:\n                raise\n\n        LOGGER.debug('create_record: %s', payload['success'])\n        return payload['success']\n\n    # List all records. Return an empty list if no records found\n    # type, name and content are used to filter records.\n    # If possible filter during the query, otherwise filter after response is received.\n    def _list_records(self, rtype=None, name=None, content=None):\n        filter_obj = {'per_page': 100}\n        if rtype:\n            filter_obj['type'] = rtype\n        if name:\n            filter_obj['name'] = self._full_name(name)\n        if content:\n            filter_obj['content'] = content\n\n        payload = self._get(\n            '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)\n\n        records = []\n        for record in payload['result']:\n            processed_record = {\n                'type': record['type'],\n                'name': record['name'],\n                'ttl': record['ttl'],\n                'content': record['content'],\n                'id': record['id']\n            }\n            records.append(processed_record)\n\n        LOGGER.debug('list_records: %s', records)\n        return records\n\n    # Create or update a record.\n    def _update_record(self, identifier, rtype=None, name=None, content=None):\n\n        data = {}\n        if rtype:\n            data['type'] = rtype\n        if name:\n            data['name'] = self._full_name(name)\n        if content:\n            data['content'] = content\n        if self._get_lexicon_option('ttl'):\n            data['ttl'] = self._get_lexicon_option('ttl')\n\n        payload = self._put(\n            '/zones/{0}/dns_records/{1}'.format(self.domain_id, identifier), data)\n\n        LOGGER.debug('update_record: %s', payload['success'])\n        return payload['success']\n\n    # Delete an existing record.\n    # If record does not exist, do nothing.\n    def _delete_record(self, identifier=None, rtype=None, name=None, content=None):\n        delete_record_id = []\n        if not identifier:\n            records = self._list_records(rtype, name, content)\n            delete_record_id = [record['id'] for record in records]\n        else:\n            delete_record_id.append(identifier)\n\n        LOGGER.debug('delete_records: %s', delete_record_id)\n\n        for record_id in delete_record_id:\n            self._delete(\n                '/zones/{0}/dns_records/{1}'.format(self.domain_id, record_id))\n\n        LOGGER.debug('delete_record: %s', True)\n        return True\n\n    # Helpers\n    def _request(self, action='GET', url='/', data=None, query_params=None):\n        if data is None:\n            data = {}\n        if query_params is None:\n            query_params = {}\n        response = requests.request(action, self.api_endpoint + url, params=query_params,\n                                    data=json.dumps(data),\n                                    headers={\n                                        'X-Auth-Email': self._get_provider_option('auth_username'),\n                                        'X-Auth-Key': self._get_provider_option('auth_token'),\n                                        'Content-Type': 'application/json'\n                                    })\n        # if the request fails for any reason, throw an error.\n        response.raise_for_status()\n        return response.json()\n", "path": "lexicon/providers/cloudflare.py"}], "after_files": [{"content": "\"\"\"Module provider for Cloudflare\"\"\"\nfrom __future__ import absolute_import\nimport json\nimport logging\n\nimport requests\nfrom lexicon.providers.base import Provider as BaseProvider\n\n\nLOGGER = logging.getLogger(__name__)\n\nNAMESERVER_DOMAINS = ['cloudflare.com']\n\n\ndef provider_parser(subparser):\n    \"\"\"Return the parser for this provider\"\"\"\n    subparser.add_argument(\n        \"--auth-username\", help=\"specify email address for authentication\")\n    subparser.add_argument(\n        \"--auth-token\", help=\"specify token for authentication\")\n\n\nclass Provider(BaseProvider):\n    \"\"\"Provider class for Cloudflare\"\"\"\n    def __init__(self, config):\n        super(Provider, self).__init__(config)\n        self.domain_id = None\n        self.api_endpoint = 'https://api.cloudflare.com/client/v4'\n\n    def _authenticate(self):\n\n        payload = self._get('/zones', {\n            'name': self.domain,\n            'status': 'active'\n        })\n\n        if not payload['result']:\n            raise Exception('No domain found')\n        if len(payload['result']) > 1:\n            raise Exception('Too many domains found. This should not happen')\n\n        self.domain_id = payload['result'][0]['id']\n\n    # Create record. If record already exists with the same content, do nothing'\n\n    def _create_record(self, rtype, name, content):\n        data = {'type': rtype, 'name': self._full_name(\n            name), 'content': content}\n        if self._get_lexicon_option('ttl'):\n            data['ttl'] = self._get_lexicon_option('ttl')\n\n        payload = {'success': True}\n        try:\n            payload = self._post(\n                '/zones/{0}/dns_records'.format(self.domain_id), data)\n        except requests.exceptions.HTTPError as err:\n            already_exists = next((True for error in err.response.json()[\n                'errors'] if error['code'] == 81057), False)\n            if not already_exists:\n                raise\n\n        LOGGER.debug('create_record: %s', payload['success'])\n        return payload['success']\n\n    # List all records. Return an empty list if no records found\n    # type, name and content are used to filter records.\n    # If possible filter during the query, otherwise filter after response is received.\n    def _list_records(self, rtype=None, name=None, content=None):\n        filter_obj = {'per_page': 100}\n        if rtype:\n            filter_obj['type'] = rtype\n        if name:\n            filter_obj['name'] = self._full_name(name)\n        if content:\n            filter_obj['content'] = content\n\n        records = []\n        while True:\n            payload = self._get(\n                '/zones/{0}/dns_records'.format(self.domain_id), filter_obj)\n\n            LOGGER.debug(\"payload: %s\", payload)\n\n            for record in payload['result']:\n                processed_record = {\n                    'type': record['type'],\n                    'name': record['name'],\n                    'ttl': record['ttl'],\n                    'content': record['content'],\n                    'id': record['id']\n                }\n                records.append(processed_record)\n\n            pages = payload['result_info']['total_pages']\n            page = payload['result_info']['page']\n            if page >= pages:\n                break\n            filter_obj['page'] = page + 1\n\n        LOGGER.debug('list_records: %s', records)\n        LOGGER.debug('Number of records retrieved: %d', len(records))\n        return records\n\n    # Create or update a record.\n    def _update_record(self, identifier, rtype=None, name=None, content=None):\n\n        data = {}\n        if rtype:\n            data['type'] = rtype\n        if name:\n            data['name'] = self._full_name(name)\n        if content:\n            data['content'] = content\n        if self._get_lexicon_option('ttl'):\n            data['ttl'] = self._get_lexicon_option('ttl')\n\n        payload = self._put(\n            '/zones/{0}/dns_records/{1}'.format(self.domain_id, identifier), data)\n\n        LOGGER.debug('update_record: %s', payload['success'])\n        return payload['success']\n\n    # Delete an existing record.\n    # If record does not exist, do nothing.\n    def _delete_record(self, identifier=None, rtype=None, name=None, content=None):\n        delete_record_id = []\n        if not identifier:\n            records = self._list_records(rtype, name, content)\n            delete_record_id = [record['id'] for record in records]\n        else:\n            delete_record_id.append(identifier)\n\n        LOGGER.debug('delete_records: %s', delete_record_id)\n\n        for record_id in delete_record_id:\n            self._delete(\n                '/zones/{0}/dns_records/{1}'.format(self.domain_id, record_id))\n\n        LOGGER.debug('delete_record: %s', True)\n        return True\n\n    # Helpers\n    def _request(self, action='GET', url='/', data=None, query_params=None):\n        if data is None:\n            data = {}\n        if query_params is None:\n            query_params = {}\n        response = requests.request(action, self.api_endpoint + url, params=query_params,\n                                    data=json.dumps(data),\n                                    headers={\n                                        'X-Auth-Email': self._get_provider_option('auth_username'),\n                                        'X-Auth-Key': self._get_provider_option('auth_token'),\n                                        'Content-Type': 'application/json'\n                                    })\n        # if the request fails for any reason, throw an error.\n        response.raise_for_status()\n        return response.json()\n", "path": "lexicon/providers/cloudflare.py"}]}