rapidata 2.21.3__py3-none-any.whl → 2.21.4__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.
Potentially problematic release.
This version of rapidata might be problematic. Click here for more details.
- rapidata/api_client/rest.py +40 -5
- {rapidata-2.21.3.dist-info → rapidata-2.21.4.dist-info}/METADATA +1 -1
- {rapidata-2.21.3.dist-info → rapidata-2.21.4.dist-info}/RECORD +5 -5
- {rapidata-2.21.3.dist-info → rapidata-2.21.4.dist-info}/LICENSE +0 -0
- {rapidata-2.21.3.dist-info → rapidata-2.21.4.dist-info}/WHEEL +0 -0
rapidata/api_client/rest.py
CHANGED
|
@@ -18,7 +18,7 @@ from typing import Dict, Optional
|
|
|
18
18
|
|
|
19
19
|
import httpx
|
|
20
20
|
from authlib.integrations.httpx_client import OAuth2Client
|
|
21
|
-
from httpx import Timeout
|
|
21
|
+
from httpx import Timeout, ConnectError
|
|
22
22
|
|
|
23
23
|
from rapidata.api_client.exceptions import ApiException, ApiValueError
|
|
24
24
|
|
|
@@ -67,7 +67,13 @@ class RESTClientObject:
|
|
|
67
67
|
**client_args,
|
|
68
68
|
)
|
|
69
69
|
|
|
70
|
-
|
|
70
|
+
try:
|
|
71
|
+
self.session.fetch_token()
|
|
72
|
+
except ConnectError as e:
|
|
73
|
+
if self._is_certificate_validation_error(e):
|
|
74
|
+
exit(self._get_ssl_verify_error_message())
|
|
75
|
+
else:
|
|
76
|
+
raise
|
|
71
77
|
|
|
72
78
|
def setup_oauth_with_token(
|
|
73
79
|
self,
|
|
@@ -218,14 +224,18 @@ class RESTClientObject:
|
|
|
218
224
|
raise ApiException(status=0, reason=msg)
|
|
219
225
|
|
|
220
226
|
else:
|
|
221
|
-
r = session.request(
|
|
222
|
-
method, url, timeout=timeout, headers=headers
|
|
223
|
-
)
|
|
227
|
+
r = session.request(method, url, timeout=timeout, headers=headers)
|
|
224
228
|
|
|
225
229
|
except httpx.HTTPError as e:
|
|
226
230
|
msg = "\n".join([type(e).__name__, str(e)])
|
|
227
231
|
raise ApiException(status=0, reason=msg)
|
|
228
232
|
|
|
233
|
+
except ConnectError as e:
|
|
234
|
+
if self._is_certificate_validation_error(e):
|
|
235
|
+
exit(self._get_ssl_verify_error_message())
|
|
236
|
+
else:
|
|
237
|
+
raise
|
|
238
|
+
|
|
229
239
|
return RESTResponse(r)
|
|
230
240
|
|
|
231
241
|
def _get_session_defaults(self):
|
|
@@ -251,3 +261,28 @@ class RESTClientObject:
|
|
|
251
261
|
client_kwargs["transport"] = transport
|
|
252
262
|
|
|
253
263
|
return client_kwargs
|
|
264
|
+
|
|
265
|
+
@staticmethod
|
|
266
|
+
def _is_certificate_validation_error(error: ConnectError) -> bool:
|
|
267
|
+
"""
|
|
268
|
+
Check if the error is related to certificate validation.
|
|
269
|
+
"""
|
|
270
|
+
return error.args[0].startswith("[SSL: CERTIFICATE_VERIFY_FAILED]")
|
|
271
|
+
|
|
272
|
+
@staticmethod
|
|
273
|
+
def _get_ssl_verify_error_message() -> str:
|
|
274
|
+
return """
|
|
275
|
+
We encountered an issue while trying to verify the SSL certificate.
|
|
276
|
+
This often happens on macOS when using the default Python installation provided by Apple,
|
|
277
|
+
which lacks the required certificates to perform secure HTTPS requests.
|
|
278
|
+
To resolve this, please perform the following steps:
|
|
279
|
+
1. Make sure you are using the latest version of the Rapidata Package: `pip install --upgrade rapidata`
|
|
280
|
+
2. If you are using the default Python installation from Apple, consider switching to a different Python distribution, such as Homebrew or pyenv.
|
|
281
|
+
3. If you prefer to continue using the default Python, you can run the following command in your terminal:
|
|
282
|
+
`/Applications/Python\\ 3.1*/Install\\ Certificates.command`
|
|
283
|
+
|
|
284
|
+
For more details on this issue, please refer to the following link:
|
|
285
|
+
https://stackoverflow.com/questions/42098126/mac-osx-python-ssl-sslerror-ssl-certificate-verify-failed-certificate-verify
|
|
286
|
+
|
|
287
|
+
If the issue persists, please reach out to us at 'info@rapidata.ai', we're happy to help you.
|
|
288
|
+
"""
|
|
@@ -412,7 +412,7 @@ rapidata/api_client/models/workflow_labeling_step_model.py,sha256=iXeIb78bdMhGFj
|
|
|
412
412
|
rapidata/api_client/models/workflow_split_model.py,sha256=zthOSaUl8dbLhLymLK_lrPTBpeV1a4cODLxnHmNCAZw,4474
|
|
413
413
|
rapidata/api_client/models/workflow_split_model_filter_configs_inner.py,sha256=1Fx9uZtztiiAdMXkj7YeCqt7o6VkG9lKf7D7UP_h088,7447
|
|
414
414
|
rapidata/api_client/models/workflow_state.py,sha256=5LAK1se76RCoozeVB6oxMPb8p_5bhLZJqn7q5fFQWis,850
|
|
415
|
-
rapidata/api_client/rest.py,sha256=
|
|
415
|
+
rapidata/api_client/rest.py,sha256=GNfE2rN_YHkiWzXiuoTHd9QlWbO99skiqwkfs3j4VHo,10834
|
|
416
416
|
rapidata/api_client_README.md,sha256=XxKjqTKsOlLbAyeUNmJWnQU2Kc7LYOsJLUZ0Q_SEIIo,55005
|
|
417
417
|
rapidata/rapidata_client/__init__.py,sha256=XP9btoeEBcUfLP_4Hi-tqmIsy__L7Q0l4LY1GRQZSKk,974
|
|
418
418
|
rapidata/rapidata_client/api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -504,7 +504,7 @@ rapidata/service/__init__.py,sha256=s9bS1AJZaWIhLtJX_ZA40_CK39rAAkwdAmymTMbeWl4,
|
|
|
504
504
|
rapidata/service/credential_manager.py,sha256=3x-Fb6tyqmgtpjI1MSOtXWW_SkzTK8Lo7I0SSL2YD7E,8602
|
|
505
505
|
rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5AnfY14BW8,877
|
|
506
506
|
rapidata/service/openapi_service.py,sha256=nh7gAmNRdZ5qu3sG7khi-pZmXhfg5u8KHdmEDQd_z9U,4075
|
|
507
|
-
rapidata-2.21.
|
|
508
|
-
rapidata-2.21.
|
|
509
|
-
rapidata-2.21.
|
|
510
|
-
rapidata-2.21.
|
|
507
|
+
rapidata-2.21.4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
508
|
+
rapidata-2.21.4.dist-info/METADATA,sha256=TbjjHPE8Y_83p_j_bYKjTUG1KWdcFhlqkOxRFEfNKds,1227
|
|
509
|
+
rapidata-2.21.4.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
|
|
510
|
+
rapidata-2.21.4.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|