rapidata 2.21.2__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.

@@ -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
- self.session.fetch_token()
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
+ """
@@ -424,4 +424,7 @@ class RapidataDataset:
424
424
  failed_uploads
425
425
  )
426
426
 
427
+ if failed_uploads:
428
+ raise RuntimeError(f"Upload failed for {failed_uploads}")
429
+
427
430
  return successful_uploads, failed_uploads
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: rapidata
3
- Version: 2.21.2
3
+ Version: 2.21.4
4
4
  Summary: Rapidata package containing the Rapidata Python Client to interact with the Rapidata Web API in an easy way.
5
5
  License: Apache-2.0
6
6
  Author: Rapidata AG
@@ -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=WTkaOPZhB24TG2mV7Ih5Km76lo2ySQXFjR98nyFIGIM,9013
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
@@ -450,7 +450,7 @@ rapidata/rapidata_client/metadata/_prompt_metadata.py,sha256=ecycAq_t2HCEptxgNxy
450
450
  rapidata/rapidata_client/metadata/_public_text_metadata.py,sha256=uXavDp1ucy_9u5n0girqWD_SkFr7tplGMK_2aqyyHIA,529
451
451
  rapidata/rapidata_client/metadata/_select_words_metadata.py,sha256=-MK5yQDi_G3BKEes6aaVyCcobB-sEy29b6bfo5f4pic,594
452
452
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
453
- rapidata/rapidata_client/order/_rapidata_dataset.py,sha256=KyEDb4NvlY4uzN3GjiX331VSGOq_I6FhvTnyKrpo4Sg,19400
453
+ rapidata/rapidata_client/order/_rapidata_dataset.py,sha256=tjUfOyDjS94xVJsebjbE5Z18hYtpaL7jwMMVjbqHwc4,19498
454
454
  rapidata/rapidata_client/order/_rapidata_order_builder.py,sha256=De-gNvOnuXHz6QaRdNpr0_3zOkIEKu8hgtZkatzxZQ4,13155
455
455
  rapidata/rapidata_client/order/rapidata_order.py,sha256=6Ak0fz0W_NUeRWz3gSTcirNTNbgEgMgruhwwEQ0BY4I,11050
456
456
  rapidata/rapidata_client/order/rapidata_order_manager.py,sha256=2HUo6d1z1qUw2PiETHlzh9fmBsCGNDPUPxVc_Udq4i8,30638
@@ -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.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
508
- rapidata-2.21.2.dist-info/METADATA,sha256=npRKolQ9iiiUYn9FbocwGWJCWYzjMTS9DJJOTLNR1Oc,1227
509
- rapidata-2.21.2.dist-info/WHEEL,sha256=fGIA9gx4Qxk2KDKeNJCbOEwSrmLtjWCwzBz351GyrPQ,88
510
- rapidata-2.21.2.dist-info/RECORD,,
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,,