rb-commons 0.5.15__py3-none-any.whl → 0.5.16__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rb_commons/http/base_api.py +9 -12
- {rb_commons-0.5.15.dist-info → rb_commons-0.5.16.dist-info}/METADATA +1 -1
- {rb_commons-0.5.15.dist-info → rb_commons-0.5.16.dist-info}/RECORD +5 -5
- {rb_commons-0.5.15.dist-info → rb_commons-0.5.16.dist-info}/WHEEL +1 -1
- {rb_commons-0.5.15.dist-info → rb_commons-0.5.16.dist-info}/top_level.txt +0 -0
rb_commons/http/base_api.py
CHANGED
@@ -66,25 +66,22 @@ class BaseAPI:
|
|
66
66
|
else:
|
67
67
|
data = {}
|
68
68
|
except ValueError as e:
|
69
|
-
|
70
|
-
|
69
|
+
error_message = data.get("message") or data.get("detail") or response.text
|
70
|
+
raise BadRequestException(f"Invalid JSON response: {response.text}", additional_info={"error_message": error_message})
|
71
71
|
if not (200 <= response.status_code < 300):
|
72
|
-
error_message = data.get("message")
|
73
|
-
|
74
|
-
raise BadRequestException(error_message)
|
75
|
-
|
76
|
-
raise BadRequestException(f"Unexpected error occured: {response.text}")
|
72
|
+
error_message = data.get("message") or data.get("detail") or response.text
|
73
|
+
raise BadRequestException(f"Unexpected error occured: {response.text}", additional_info={"error_message": error_message})
|
77
74
|
|
78
75
|
return response
|
79
76
|
|
80
77
|
except RequestException as e:
|
81
|
-
raise BadRequestException(f"Request
|
82
|
-
except BadRequestException
|
83
|
-
raise
|
78
|
+
raise BadRequestException(f"Request exception: {str(e)}", additional_info={"error_message": str(e)})
|
79
|
+
except BadRequestException:
|
80
|
+
raise
|
84
81
|
except (json.JSONDecodeError, ValueError) as e:
|
85
|
-
raise InternalException(f"Failed to parse JSON: {e}")
|
82
|
+
raise InternalException(f"Failed to parse JSON: {str(e)}")
|
86
83
|
except Exception as e:
|
87
|
-
raise InternalException("
|
84
|
+
raise InternalException(f"Unhandled error: {str(e)}")
|
88
85
|
|
89
86
|
def _post(self, path: str, data: dict | list, headers: dict = None, params: dict = None, reset_base_url: bool = False, form_encoded: bool = False) -> requests.Response:
|
90
87
|
return self._make_request('POST', path, data=data, headers=headers, params=params, reset_base_url=reset_base_url, form_encoded=form_encoded)
|
@@ -8,7 +8,7 @@ rb_commons/configs/rabbitmq.py,sha256=vUqa_PcZkPp1lX0B6HLSAXVMUcPR2_8-8cN-C7xFxR
|
|
8
8
|
rb_commons/configs/v2/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
rb_commons/configs/v2/config.py,sha256=kZ02y_HIMD-SXqA990yR1r9qrkpvzwn4Nda6fhVMcmo,1581
|
10
10
|
rb_commons/http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
11
|
-
rb_commons/http/base_api.py,sha256=
|
11
|
+
rb_commons/http/base_api.py,sha256=L4bZmJJrtfIp0N9vdlc9m8FzyZXb3dZ7_RMe4RQVers,5313
|
12
12
|
rb_commons/http/consul.py,sha256=Ioq72VD1jGwoC96set7n2SgxN40olzI-myA2lwKkYi4,1864
|
13
13
|
rb_commons/http/exceptions.py,sha256=EGRMr1cRgiJ9Q2tkfANbf0c6-zzXf1CD6J3cmCaT_FA,1885
|
14
14
|
rb_commons/orm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
@@ -22,7 +22,7 @@ rb_commons/schemes/jwt.py,sha256=4MLw3J1-LiU2CXIgm0kP1mlGoDmNfMXmj9iav2s-1Iw,205
|
|
22
22
|
rb_commons/schemes/pagination.py,sha256=8VZW1wZGJIPR9jEBUgppZUoB4uqP8ORudHkMwvEJSxg,1866
|
23
23
|
rb_commons/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
24
24
|
rb_commons/utils/media.py,sha256=J2Zi0J28DhcVQVzt-myNNVuzj9Msaetul53VjZtdDdc,820
|
25
|
-
rb_commons-0.5.
|
26
|
-
rb_commons-0.5.
|
27
|
-
rb_commons-0.5.
|
28
|
-
rb_commons-0.5.
|
25
|
+
rb_commons-0.5.16.dist-info/METADATA,sha256=Qe3eYj1PSMM85qmjtBzpY8TxcbOIAQjqQShsH56p_Lk,6571
|
26
|
+
rb_commons-0.5.16.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
|
27
|
+
rb_commons-0.5.16.dist-info/top_level.txt,sha256=HPx_WAYo3_fbg1WCeGHsz3wPGio1ucbnrlm2lmqlJog,11
|
28
|
+
rb_commons-0.5.16.dist-info/RECORD,,
|
File without changes
|