We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
api change of online.net broke lexicon plugin
Hi,

Blame them ! i'm working on it...

--- 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/online.py`
Content:
```
1 from __future__ import absolute_import
2 from __future__ import print_function
3 
4 import json
5 import logging
6 
7 import requests
8 
9 from .base import Provider as BaseProvider
10 
11 logger = logging.getLogger(__name__)
12 
13 
14 def ProviderParser(subparser):
15     subparser.add_argument("--auth-token", help="specify private api token")
16 
17 def to_data(type, content):
18     if type == "TXT":
19         return '"{0}"'.format(content)
20     else:
21         return content
22 
23 class Provider(BaseProvider):
24 
25     def __init__(self, options, engine_overrides=None):
26         super(Provider, self).__init__(options, engine_overrides)
27         self.zone_name = 'Zone Automatic Lexicon '
28         self.domain_id = None
29         self.passive_zone = None
30         self.active_zone = None
31         self.api_endpoint = self.engine_overrides.get('api_endpoint', 'https://api.online.net/api/v1')
32 
33     def authenticate(self):
34         payload = self._get('/domain/')
35         domain = self.options['domain']
36         did = None
37         for row in payload:
38             if row['name'] == domain:
39                 did = row['id']
40                 break
41 
42         if did is None:
43             raise Exception('No domain found')
44 
45         self.domain_id = did
46         self.init_zones()
47 
48     def list_zones(self):
49         return self._get('/domain/{0}/version'.format(self.domain_id))
50 
51     def init_zones(self):
52         # sets current zone version
53         zone_name_a = self.zone_name + 'A'
54         zone_name_b = self.zone_name + 'B'
55         active_row = None
56         passive_row = None
57         for row in self.list_zones():
58             if row['active'] == True:
59                 active_row = row
60             elif row['name'] == zone_name_a or row['name'] == zone_name_b:
61                 passive_row = row
62 
63         if passive_row is None:
64             passive_row = self._post('/domain/{0}/version'.format(self.domain_id), {
65                 'name': zone_name_b if active_row['name'] == zone_name_a else zone_name_a
66             })
67 
68         self.active_zone = active_row['uuid_ref']
69         self.passive_zone = passive_row['uuid_ref']
70         self.update_passive_zone()
71 
72 
73     def update_passive_zone(self):
74         self._put(
75             '/domain/{0}/version/{1}/zone_from_bind'.format(
76                 self.domain_id,
77                 self.passive_zone
78             ),
79             self.get_bind_zone()
80         )
81 
82     def get_bind_zone(self):
83         records = self.list_zone_records(self.active_zone)
84          # then convert records to bind format
85         bindStr = ''
86         for record in records:
87             bindStr = bindStr + '{0} {1} IN {2} {3}{4}\n'.format(
88                 record['name'] or '@',
89                 record['ttl'],
90                 record['type'],
91                 '{0} '.format(record['aux']) if 'aux' in record else '',
92                 record['data'] or ''
93             )
94         return bindStr
95 
96     def enable_zone(self):
97         zone = self.passive_zone
98         if zone is None:
99             raise Exception("Could not enable uninitialized passive_zone")
100         payload = self._patch('/domain/{0}/version/{1}/enable'.format(
101             self.domain_id,
102             zone
103         ))
104         self.passive_zone = self.active_zone
105         self.active_zone = zone
106         self.update_passive_zone()
107 
108 
109     # Create record. If record already exists with the same content, do nothing'
110     def create_record(self, type, name, content):
111         try:
112             record = self.find_record(type, name, content)
113             if record is not None:
114                 return True
115 
116             record = {
117                 'name': self._fqdn_name(name),
118                 'type': type,
119                 'data': to_data(type, content),
120                 'priority': self.options['priority'] or '',
121                 'ttl': self.options['ttl'] or ''
122             }
123 
124             payload = self._post(
125                 '/domain/{0}/version/{1}/zone'.format(
126                     self.domain_id,
127                     self.passive_zone
128                 ),
129                 record
130             )
131         except Exception as e:
132             logger.debug(e)
133             return False
134 
135         self.enable_zone()
136         logger.debug('create_record: %s', True)
137         return True
138 
139     def find_zone_records(self, zone, type=None, name=None, content=None):
140         records = []
141         for record in self.list_zone_records(zone):
142             processed_record = {
143                 'id': record['id'],
144                 'type': record['type'],
145                 'name': self._full_name(record['name']),
146                 'ttl': record['ttl'],
147                 'content': record['data'],
148                 'priority': record['aux'] if 'aux' in record else ''
149             }
150             records.append(self._clean_TXT_record(processed_record))
151 
152         if type:
153             records = [record for record in records if record['type'] == type]
154         if name:
155             fullName = self._full_name(name)
156             records = [record for record in records if record['name'] == fullName]
157         if content:
158             records = [record for record in records if record['content'] == content]
159 
160         logger.debug('list_records: %s', records)
161         return records
162 
163     def list_zone_records(self, zone_id):
164         return self._get('/domain/{0}/version/{1}/zone'.format(self.domain_id, zone_id))
165 
166     def list_records(self, type=None, name=None, content=None):
167         return self.find_zone_records(self.passive_zone, type, name, content)
168 
169     def find_record(self, type=None, name=None, content=None):
170         record = None
171         records = self.list_records(type, name, content)
172         if len(records) < 1:
173             return None
174         else:
175             return records[0]
176 
177 
178     # Create or update a record.
179     def update_record(self, id, type=None, name=None, content=None):
180         record = self.find_record(type, name)
181         if record is None:
182             logger.debug("cannot find record to update: %s %s %s", id, type, name)
183             return True
184         if type:
185             record['type'] = type
186         if name:
187             record['name'] = self._fqdn_name(name)
188         if content:
189             record['data'] = to_data(type, content)
190         if self.options.get('ttl'):
191             record['ttl'] = self.options.get('ttl')
192         # it is weird that 'aux' becomes 'priority' in online's api
193         if self.options['priority']:
194             record['priority'] = self.options['priority']
195 
196         if id is None:
197             id = record['id']
198 
199         record.pop('id')
200 
201         try:
202             payload = self._patch('/domain/{0}/version/{1}/zone/{2}'.format(
203                 self.domain_id,
204                 self.passive_zone,
205                 id
206             ), record)
207 
208         except Exception as e:
209             logger.debug(e)
210             return False
211 
212         self.enable_zone()
213         # If it didn't raise from the http status code, then we're good
214         logger.debug('update_record: %s', id)
215         return True
216 
217     # Delete an existing record.
218     # If record does not exist, do nothing.
219     def delete_record(self, id=None, type=None, name=None, content=None):
220         records = self.list_records(type, name, content)
221         if len(records) == 0:
222             logger.debug("Cannot find records %s %s %s", type, name, content)
223             return False
224         logger.debug('delete_records: %s records found', len(records))
225         try:
226             for record in records:
227                 payload = self._delete('/domain/{0}/version/{1}/zone/{2}'.format(
228                     self.domain_id,
229                     self.passive_zone,
230                     record['id']
231                 ))
232         except Exception as e:
233             logger.debug(e)
234             return False
235 
236         self.enable_zone()
237         # is always True at this point, if a non 200 response is returned an error is raised.
238         logger.debug('delete_record: %s', True)
239         return True
240 
241     def _patch(self, url='/', data=None, query_params=None):
242         return self._request('PATCH', url, data=data, query_params=query_params)
243 
244     # Helpers
245     def _request(self, action='GET',  url='/', data=None, query_params=None):
246         if query_params is None:
247             query_params = {}
248 
249         headers = {
250             'Accept': 'application/json',
251             'Authorization': 'Bearer {0}'.format(self.options['auth_token'])
252         }
253         if data is not None:
254             if type(data) is str:
255                 headers['Content-Type'] = 'text/plain';
256             else:
257                 headers['Content-Type'] = 'application/json';
258                 data = json.dumps(data)
259 
260         r = requests.request(
261             action,
262             self.api_endpoint + url,
263             params=query_params,
264             data=data,
265             headers=headers
266         )
267         r.raise_for_status()  # if the request fails for any reason, throw an error.
268 
269         return r.text and r.json() or ''
270
```
--- 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/online.py b/lexicon/providers/online.py
--- a/lexicon/providers/online.py
+++ b/lexicon/providers/online.py
@@ -25,24 +25,12 @@
     def __init__(self, options, engine_overrides=None):
         super(Provider, self).__init__(options, engine_overrides)
         self.zone_name = 'Zone Automatic Lexicon '
-        self.domain_id = None
         self.passive_zone = None
         self.active_zone = None
+        self.domain_id = self.options['domain']
         self.api_endpoint = self.engine_overrides.get('api_endpoint', 'https://api.online.net/api/v1')
 
     def authenticate(self):
-        payload = self._get('/domain/')
-        domain = self.options['domain']
-        did = None
-        for row in payload:
-            if row['name'] == domain:
-                did = row['id']
-                break
-
-        if did is None:
-            raise Exception('No domain found')
-
-        self.domain_id = did
         self.init_zones()
 
     def list_zones(self):

{"golden_diff": "diff --git a/lexicon/providers/online.py b/lexicon/providers/online.py\n--- a/lexicon/providers/online.py\n+++ b/lexicon/providers/online.py\n@@ -25,24 +25,12 @@\n     def __init__(self, options, engine_overrides=None):\n         super(Provider, self).__init__(options, engine_overrides)\n         self.zone_name = 'Zone Automatic Lexicon '\n-        self.domain_id = None\n         self.passive_zone = None\n         self.active_zone = None\n+        self.domain_id = self.options['domain']\n         self.api_endpoint = self.engine_overrides.get('api_endpoint', 'https://api.online.net/api/v1')\n \n     def authenticate(self):\n-        payload = self._get('/domain/')\n-        domain = self.options['domain']\n-        did = None\n-        for row in payload:\n-            if row['name'] == domain:\n-                did = row['id']\n-                break\n-\n-        if did is None:\n-            raise Exception('No domain found')\n-\n-        self.domain_id = did\n         self.init_zones()\n \n     def list_zones(self):\n", "issue": "api change of online.net broke lexicon plugin\nHi,\r\n\r\nBlame them ! i'm working on it...\n", "before_files": [{"content": "from __future__ import absolute_import\nfrom __future__ import print_function\n\nimport json\nimport logging\n\nimport requests\n\nfrom .base import Provider as BaseProvider\n\nlogger = logging.getLogger(__name__)\n\n\ndef ProviderParser(subparser):\n    subparser.add_argument(\"--auth-token\", help=\"specify private api token\")\n\ndef to_data(type, content):\n    if type == \"TXT\":\n        return '\"{0}\"'.format(content)\n    else:\n        return content\n\nclass Provider(BaseProvider):\n\n    def __init__(self, options, engine_overrides=None):\n        super(Provider, self).__init__(options, engine_overrides)\n        self.zone_name = 'Zone Automatic Lexicon '\n        self.domain_id = None\n        self.passive_zone = None\n        self.active_zone = None\n        self.api_endpoint = self.engine_overrides.get('api_endpoint', 'https://api.online.net/api/v1')\n\n    def authenticate(self):\n        payload = self._get('/domain/')\n        domain = self.options['domain']\n        did = None\n        for row in payload:\n            if row['name'] == domain:\n                did = row['id']\n                break\n\n        if did is None:\n            raise Exception('No domain found')\n\n        self.domain_id = did\n        self.init_zones()\n\n    def list_zones(self):\n        return self._get('/domain/{0}/version'.format(self.domain_id))\n\n    def init_zones(self):\n        # sets current zone version\n        zone_name_a = self.zone_name + 'A'\n        zone_name_b = self.zone_name + 'B'\n        active_row = None\n        passive_row = None\n        for row in self.list_zones():\n            if row['active'] == True:\n                active_row = row\n            elif row['name'] == zone_name_a or row['name'] == zone_name_b:\n                passive_row = row\n\n        if passive_row is None:\n            passive_row = self._post('/domain/{0}/version'.format(self.domain_id), {\n                'name': zone_name_b if active_row['name'] == zone_name_a else zone_name_a\n            })\n\n        self.active_zone = active_row['uuid_ref']\n        self.passive_zone = passive_row['uuid_ref']\n        self.update_passive_zone()\n\n\n    def update_passive_zone(self):\n        self._put(\n            '/domain/{0}/version/{1}/zone_from_bind'.format(\n                self.domain_id,\n                self.passive_zone\n            ),\n            self.get_bind_zone()\n        )\n\n    def get_bind_zone(self):\n        records = self.list_zone_records(self.active_zone)\n         # then convert records to bind format\n        bindStr = ''\n        for record in records:\n            bindStr = bindStr + '{0} {1} IN {2} {3}{4}\\n'.format(\n                record['name'] or '@',\n                record['ttl'],\n                record['type'],\n                '{0} '.format(record['aux']) if 'aux' in record else '',\n                record['data'] or ''\n            )\n        return bindStr\n\n    def enable_zone(self):\n        zone = self.passive_zone\n        if zone is None:\n            raise Exception(\"Could not enable uninitialized passive_zone\")\n        payload = self._patch('/domain/{0}/version/{1}/enable'.format(\n            self.domain_id,\n            zone\n        ))\n        self.passive_zone = self.active_zone\n        self.active_zone = zone\n        self.update_passive_zone()\n\n\n    # Create record. If record already exists with the same content, do nothing'\n    def create_record(self, type, name, content):\n        try:\n            record = self.find_record(type, name, content)\n            if record is not None:\n                return True\n\n            record = {\n                'name': self._fqdn_name(name),\n                'type': type,\n                'data': to_data(type, content),\n                'priority': self.options['priority'] or '',\n                'ttl': self.options['ttl'] or ''\n            }\n\n            payload = self._post(\n                '/domain/{0}/version/{1}/zone'.format(\n                    self.domain_id,\n                    self.passive_zone\n                ),\n                record\n            )\n        except Exception as e:\n            logger.debug(e)\n            return False\n\n        self.enable_zone()\n        logger.debug('create_record: %s', True)\n        return True\n\n    def find_zone_records(self, zone, type=None, name=None, content=None):\n        records = []\n        for record in self.list_zone_records(zone):\n            processed_record = {\n                'id': record['id'],\n                'type': record['type'],\n                'name': self._full_name(record['name']),\n                'ttl': record['ttl'],\n                'content': record['data'],\n                'priority': record['aux'] if 'aux' in record else ''\n            }\n            records.append(self._clean_TXT_record(processed_record))\n\n        if type:\n            records = [record for record in records if record['type'] == type]\n        if name:\n            fullName = self._full_name(name)\n            records = [record for record in records if record['name'] == fullName]\n        if content:\n            records = [record for record in records if record['content'] == content]\n\n        logger.debug('list_records: %s', records)\n        return records\n\n    def list_zone_records(self, zone_id):\n        return self._get('/domain/{0}/version/{1}/zone'.format(self.domain_id, zone_id))\n\n    def list_records(self, type=None, name=None, content=None):\n        return self.find_zone_records(self.passive_zone, type, name, content)\n\n    def find_record(self, type=None, name=None, content=None):\n        record = None\n        records = self.list_records(type, name, content)\n        if len(records) < 1:\n            return None\n        else:\n            return records[0]\n\n\n    # Create or update a record.\n    def update_record(self, id, type=None, name=None, content=None):\n        record = self.find_record(type, name)\n        if record is None:\n            logger.debug(\"cannot find record to update: %s %s %s\", id, type, name)\n            return True\n        if type:\n            record['type'] = type\n        if name:\n            record['name'] = self._fqdn_name(name)\n        if content:\n            record['data'] = to_data(type, content)\n        if self.options.get('ttl'):\n            record['ttl'] = self.options.get('ttl')\n        # it is weird that 'aux' becomes 'priority' in online's api\n        if self.options['priority']:\n            record['priority'] = self.options['priority']\n\n        if id is None:\n            id = record['id']\n\n        record.pop('id')\n\n        try:\n            payload = self._patch('/domain/{0}/version/{1}/zone/{2}'.format(\n                self.domain_id,\n                self.passive_zone,\n                id\n            ), record)\n\n        except Exception as e:\n            logger.debug(e)\n            return False\n\n        self.enable_zone()\n        # If it didn't raise from the http status code, then we're good\n        logger.debug('update_record: %s', id)\n        return True\n\n    # Delete an existing record.\n    # If record does not exist, do nothing.\n    def delete_record(self, id=None, type=None, name=None, content=None):\n        records = self.list_records(type, name, content)\n        if len(records) == 0:\n            logger.debug(\"Cannot find records %s %s %s\", type, name, content)\n            return False\n        logger.debug('delete_records: %s records found', len(records))\n        try:\n            for record in records:\n                payload = self._delete('/domain/{0}/version/{1}/zone/{2}'.format(\n                    self.domain_id,\n                    self.passive_zone,\n                    record['id']\n                ))\n        except Exception as e:\n            logger.debug(e)\n            return False\n\n        self.enable_zone()\n        # is always True at this point, if a non 200 response is returned an error is raised.\n        logger.debug('delete_record: %s', True)\n        return True\n\n    def _patch(self, url='/', data=None, query_params=None):\n        return self._request('PATCH', url, data=data, query_params=query_params)\n\n    # Helpers\n    def _request(self, action='GET',  url='/', data=None, query_params=None):\n        if query_params is None:\n            query_params = {}\n\n        headers = {\n            'Accept': 'application/json',\n            'Authorization': 'Bearer {0}'.format(self.options['auth_token'])\n        }\n        if data is not None:\n            if type(data) is str:\n                headers['Content-Type'] = 'text/plain';\n            else:\n                headers['Content-Type'] = 'application/json';\n                data = json.dumps(data)\n\n        r = requests.request(\n            action,\n            self.api_endpoint + url,\n            params=query_params,\n            data=data,\n            headers=headers\n        )\n        r.raise_for_status()  # if the request fails for any reason, throw an error.\n\n        return r.text and r.json() or ''\n", "path": "lexicon/providers/online.py"}], "after_files": [{"content": "from __future__ import absolute_import\nfrom __future__ import print_function\n\nimport json\nimport logging\n\nimport requests\n\nfrom .base import Provider as BaseProvider\n\nlogger = logging.getLogger(__name__)\n\n\ndef ProviderParser(subparser):\n    subparser.add_argument(\"--auth-token\", help=\"specify private api token\")\n\ndef to_data(type, content):\n    if type == \"TXT\":\n        return '\"{0}\"'.format(content)\n    else:\n        return content\n\nclass Provider(BaseProvider):\n\n    def __init__(self, options, engine_overrides=None):\n        super(Provider, self).__init__(options, engine_overrides)\n        self.zone_name = 'Zone Automatic Lexicon '\n        self.passive_zone = None\n        self.active_zone = None\n        self.domain_id = self.options['domain']\n        self.api_endpoint = self.engine_overrides.get('api_endpoint', 'https://api.online.net/api/v1')\n\n    def authenticate(self):\n        self.init_zones()\n\n    def list_zones(self):\n        return self._get('/domain/{0}/version'.format(self.domain_id))\n\n    def init_zones(self):\n        # sets current zone version\n        zone_name_a = self.zone_name + 'A'\n        zone_name_b = self.zone_name + 'B'\n        active_row = None\n        passive_row = None\n        for row in self.list_zones():\n            if row['active'] == True:\n                active_row = row\n            elif row['name'] == zone_name_a or row['name'] == zone_name_b:\n                passive_row = row\n\n        if passive_row is None:\n            passive_row = self._post('/domain/{0}/version'.format(self.domain_id), {\n                'name': zone_name_b if active_row['name'] == zone_name_a else zone_name_a\n            })\n\n        self.active_zone = active_row['uuid_ref']\n        self.passive_zone = passive_row['uuid_ref']\n        self.update_passive_zone()\n\n\n    def update_passive_zone(self):\n        self._put(\n            '/domain/{0}/version/{1}/zone_from_bind'.format(\n                self.domain_id,\n                self.passive_zone\n            ),\n            self.get_bind_zone()\n        )\n\n    def get_bind_zone(self):\n        records = self.list_zone_records(self.active_zone)\n         # then convert records to bind format\n        bindStr = ''\n        for record in records:\n            bindStr = bindStr + '{0} {1} IN {2} {3}{4}\\n'.format(\n                record['name'] or '@',\n                record['ttl'],\n                record['type'],\n                '{0} '.format(record['aux']) if 'aux' in record else '',\n                record['data'] or ''\n            )\n        return bindStr\n\n    def enable_zone(self):\n        zone = self.passive_zone\n        if zone is None:\n            raise Exception(\"Could not enable uninitialized passive_zone\")\n        payload = self._patch('/domain/{0}/version/{1}/enable'.format(\n            self.domain_id,\n            zone\n        ))\n        self.passive_zone = self.active_zone\n        self.active_zone = zone\n        self.update_passive_zone()\n\n\n    # Create record. If record already exists with the same content, do nothing'\n    def create_record(self, type, name, content):\n        try:\n            record = self.find_record(type, name, content)\n            if record is not None:\n                return True\n\n            record = {\n                'name': self._fqdn_name(name),\n                'type': type,\n                'data': to_data(type, content),\n                'priority': self.options['priority'] or '',\n                'ttl': self.options['ttl'] or ''\n            }\n\n            payload = self._post(\n                '/domain/{0}/version/{1}/zone'.format(\n                    self.domain_id,\n                    self.passive_zone\n                ),\n                record\n            )\n        except Exception as e:\n            logger.debug(e)\n            return False\n\n        self.enable_zone()\n        logger.debug('create_record: %s', True)\n        return True\n\n    def find_zone_records(self, zone, type=None, name=None, content=None):\n        records = []\n        for record in self.list_zone_records(zone):\n            processed_record = {\n                'id': record['id'],\n                'type': record['type'],\n                'name': self._full_name(record['name']),\n                'ttl': record['ttl'],\n                'content': record['data'],\n                'priority': record['aux'] if 'aux' in record else ''\n            }\n            records.append(self._clean_TXT_record(processed_record))\n\n        if type:\n            records = [record for record in records if record['type'] == type]\n        if name:\n            fullName = self._full_name(name)\n            records = [record for record in records if record['name'] == fullName]\n        if content:\n            records = [record for record in records if record['content'] == content]\n\n        logger.debug('list_records: %s', records)\n        return records\n\n    def list_zone_records(self, zone_id):\n        return self._get('/domain/{0}/version/{1}/zone'.format(self.domain_id, zone_id))\n\n    def list_records(self, type=None, name=None, content=None):\n        return self.find_zone_records(self.passive_zone, type, name, content)\n\n    def find_record(self, type=None, name=None, content=None):\n        record = None\n        records = self.list_records(type, name, content)\n        if len(records) < 1:\n            return None\n        else:\n            return records[0]\n\n\n    # Create or update a record.\n    def update_record(self, id, type=None, name=None, content=None):\n        record = self.find_record(type, name)\n        if record is None:\n            logger.debug(\"cannot find record to update: %s %s %s\", id, type, name)\n            return True\n        if type:\n            record['type'] = type\n        if name:\n            record['name'] = self._fqdn_name(name)\n        if content:\n            record['data'] = to_data(type, content)\n        if self.options.get('ttl'):\n            record['ttl'] = self.options.get('ttl')\n        # it is weird that 'aux' becomes 'priority' in online's api\n        if self.options['priority']:\n            record['priority'] = self.options['priority']\n\n        if id is None:\n            id = record['id']\n\n        record.pop('id')\n\n        try:\n            payload = self._patch('/domain/{0}/version/{1}/zone/{2}'.format(\n                self.domain_id,\n                self.passive_zone,\n                id\n            ), record)\n\n        except Exception as e:\n            logger.debug(e)\n            return False\n\n        self.enable_zone()\n        # If it didn't raise from the http status code, then we're good\n        logger.debug('update_record: %s', id)\n        return True\n\n    # Delete an existing record.\n    # If record does not exist, do nothing.\n    def delete_record(self, id=None, type=None, name=None, content=None):\n        records = self.list_records(type, name, content)\n        if len(records) == 0:\n            logger.debug(\"Cannot find records %s %s %s\", type, name, content)\n            return False\n        logger.debug('delete_records: %s records found', len(records))\n        try:\n            for record in records:\n                payload = self._delete('/domain/{0}/version/{1}/zone/{2}'.format(\n                    self.domain_id,\n                    self.passive_zone,\n                    record['id']\n                ))\n        except Exception as e:\n            logger.debug(e)\n            return False\n\n        self.enable_zone()\n        # is always True at this point, if a non 200 response is returned an error is raised.\n        logger.debug('delete_record: %s', True)\n        return True\n\n    def _patch(self, url='/', data=None, query_params=None):\n        return self._request('PATCH', url, data=data, query_params=query_params)\n\n    # Helpers\n    def _request(self, action='GET',  url='/', data=None, query_params=None):\n        if query_params is None:\n            query_params = {}\n\n        headers = {\n            'Accept': 'application/json',\n            'Authorization': 'Bearer {0}'.format(self.options['auth_token'])\n        }\n        if data is not None:\n            if type(data) is str:\n                headers['Content-Type'] = 'text/plain';\n            else:\n                headers['Content-Type'] = 'application/json';\n                data = json.dumps(data)\n\n        r = requests.request(\n            action,\n            self.api_endpoint + url,\n            params=query_params,\n            data=data,\n            headers=headers\n        )\n        r.raise_for_status()  # if the request fails for any reason, throw an error.\n\n        return r.text and r.json() or ''\n", "path": "lexicon/providers/online.py"}]}