From cf4e7ff411e60d887a0255497ccd44e9332213fe Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Fri, 19 Sep 2025 19:12:51 +0200 Subject: [PATCH] Handle expected 204 In case of uploading the problemset we expect a HTTP204 which is not valid JSON and would throw an error by design. --- misc-tools/dj_utils.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/misc-tools/dj_utils.py b/misc-tools/dj_utils.py index d41d31f802..873074ebdb 100644 --- a/misc-tools/dj_utils.py +++ b/misc-tools/dj_utils.py @@ -147,11 +147,12 @@ def upload_file(name: str, apifilename: str, file: str, data: dict = {}): result = parse_api_response(name, response) - try: - result = json.loads(result) - except json.decoder.JSONDecodeError as e: - print(result) - raise RuntimeError(f'Failed to JSON decode the response for API file upload request {name}') + if result is not None: + try: + result = json.loads(result) + except json.decoder.JSONDecodeError as e: + print(result) + raise RuntimeError(f'Failed to JSON decode the response for API file upload request {name}') return result