Skip to content

Commit 0fd118e

Browse files
committed
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.
1 parent bf78085 commit 0fd118e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

misc-tools/dj_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ def upload_file(name: str, apifilename: str, file: str, data: dict = {}):
147147

148148
result = parse_api_response(name, response)
149149

150+
if response.status_code == 204:
151+
return result
150152
try:
151153
result = json.loads(result)
152154
except json.decoder.JSONDecodeError as e:
153-
print(result)
154155
raise RuntimeError(f'Failed to JSON decode the response for API file upload request {name}')
155156

156157
return result

0 commit comments

Comments
 (0)