From f39145199aeb2c5ef0c0b6e01226bf22215d47a1 Mon Sep 17 00:00:00 2001 From: Leandro Rosemberg Date: Tue, 20 Aug 2024 09:45:45 -0300 Subject: [PATCH] Cast response to json in some cases --- roboflow/adapters/rfapi.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/roboflow/adapters/rfapi.py b/roboflow/adapters/rfapi.py index 4a93caa9..3e1d1982 100644 --- a/roboflow/adapters/rfapi.py +++ b/roboflow/adapters/rfapi.py @@ -112,13 +112,13 @@ def upload_image( raise ImageUploadError(err_msg, status_code=response.status_code) else: - raise ImageUploadError(response, status_code=response.status_code) + raise ImageUploadError(str(response), status_code=response.status_code) if not responsejson: # fail fast - raise ImageUploadError(response, status_code=response.status_code) + raise ImageUploadError(str(response), status_code=response.status_code) if not (responsejson.get("success") or responsejson.get("duplicate")): - message = responsejson.get("message") or responsejson + message = responsejson.get("message") or str(responsejson) raise ImageUploadError(message) return responsejson @@ -236,4 +236,4 @@ def _save_annotation_error(response): err_msg = err_msg["message"] return AnnotationSaveError(err_msg, status_code=response.status_code) - return AnnotationSaveError(responsejson, status_code=response.status_code) + return AnnotationSaveError(str(responsejson), status_code=response.status_code)