From 8ddf7fad7f8a71bd251fec16435c0013d103bf3d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 30 Jan 2025 22:22:55 +0000 Subject: [PATCH 1/2] fix: handle empty 2xx responses gracefully Co-Authored-By: matt@knock.app --- knockapi/client.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/knockapi/client.py b/knockapi/client.py index 21914fb..f70aa54 100644 --- a/knockapi/client.py +++ b/knockapi/client.py @@ -30,12 +30,14 @@ def request(self, method, endpoint, payload=None, options={}): timeout=self.timeout, ) - # If we got a successful response, then attempt to deserialize as JSON + # If we got a successful response, check for content before attempting to deserialize as JSON if r.ok: - try: - return r.json() - except JSONDecodeError: - return None + if r.content and len(r.content) > 0: + try: + return r.json() + except JSONDecodeError: + return None + return None return r.raise_for_status() From 1e3ab67f0b09fba40272af4a764b801b78b8abf0 Mon Sep 17 00:00:00 2001 From: Matt Kufchak Date: Fri, 31 Jan 2025 11:06:00 -0600 Subject: [PATCH 2/2] chore: prepare for 0.5.14 release --- knockapi/_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/knockapi/_version.py b/knockapi/_version.py index 2dda8e8..3c6f84b 100644 --- a/knockapi/_version.py +++ b/knockapi/_version.py @@ -1 +1 @@ -__version__ = '0.5.13' +__version__ = '0.5.14'