Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit 1a5a859

Browse files
committed
improve error message responses for 400-405 http reponses code - they now decode Cloudflare error values
1 parent e3b2631 commit 1a5a859

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CloudFlare/cloudflare.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,13 +333,13 @@ def _call_network(self, method, headers, parts, identifiers, params, data_str, d
333333
self.logger.debug('Response: 429 Header Retry-After: %s', retry_after)
334334

335335
# if (response_code >= 400 and response_code <= 499) or response_code == 500:
336-
if response_code in [400,500]:
336+
if response_code in [400,401,403,404,405,500]:
337337
# The /certificates API call insists on a 500 error return and yet has valid error data
338338
# Other API calls can return 400 or 4xx with valid response data
339339
# lets check and convert if able
340340
try:
341341
j = json.loads(response_data)
342-
if 'status' not in j and 'errors' not in j:
342+
if 'success' not in j and 'errors' not in j:
343343
# no go - it's not a Cloudflare error format
344344
pass
345345
else:

0 commit comments

Comments
 (0)