|
1 | 1 | # |
2 | | -# Copyright (c) 2014 NSONE, Inc. |
| 2 | +# Copyright IBM Corp. 2014, 2026 |
3 | 3 | # |
4 | 4 | # License under The MIT License (MIT). See LICENSE in project root. |
5 | 5 | # |
@@ -225,27 +225,13 @@ def get_zonefile_export(self, zone, callback=None, errback=None): |
225 | 225 | :param str zone: zone name |
226 | 226 | :return: zone file content as string |
227 | 227 | """ |
228 | | - # Note: This endpoint returns raw zone file text, not JSON |
229 | | - # The transport layer will try to parse it as JSON and fail |
230 | | - # We catch that exception and extract the raw body text |
231 | | - try: |
232 | | - return self._make_request( |
233 | | - "GET", |
234 | | - f"export/zonefile/{zone}", |
235 | | - callback=callback, |
236 | | - errback=errback, |
237 | | - ) |
238 | | - except ResourceException as e: |
239 | | - # Check if this is a valid zonefile response (plain text) |
240 | | - # The response should be 200 OK with text/plain content |
241 | | - if e.response and e.response.getcode() == 200: |
242 | | - # Check content-type header for text/plain |
243 | | - content_type = e.response.getheader("Content-Type", "") |
244 | | - if "text/plain" in content_type or "text" in content_type: |
245 | | - # This is the expected plain text zonefile |
246 | | - return e.body if e.body else "" |
247 | | - # Otherwise, this is a real error - re-raise it |
248 | | - raise |
| 228 | + return self._make_request( |
| 229 | + "GET", |
| 230 | + f"export/zonefile/{zone}", |
| 231 | + callback=callback, |
| 232 | + errback=errback, |
| 233 | + skip_json_parsing=True, |
| 234 | + ) |
249 | 235 |
|
250 | 236 |
|
251 | 237 | # successive pages just extend the list of zones |
|
0 commit comments