rapidata 1.4.0__py3-none-any.whl → 1.4.2__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.

@@ -11,10 +11,14 @@ from rapidata.rapidata_client.dataset.rapidata_dataset import RapidataDataset
11
11
  from rapidata.rapidata_client.simple_builders.simple_classification_builders import ClassificationQuestionBuilder
12
12
  from rapidata.rapidata_client.simple_builders.simple_compare_builders import CompareCriteriaBuilder
13
13
 
14
+ from rapidata.api_client.exceptions import BadRequestException
15
+ from urllib3._collections import HTTPHeaderDict
16
+
14
17
  from rapidata.api_client.models.query_orders_model import QueryOrdersModel
15
18
  from rapidata.api_client.models.page_info import PageInfo
16
19
  from rapidata.api_client.models.root_filter import RootFilter
17
20
  from rapidata.api_client.models.filter import Filter
21
+ from rapidata.api_client.models.sort_criterion import SortCriterion
18
22
 
19
23
 
20
24
  class RapidataClient:
@@ -103,12 +107,13 @@ class RapidataClient:
103
107
  name=order.order_name,
104
108
  openapi_service=self.openapi_service)
105
109
 
106
- def find_orders(self, name: str = "", amount: int = 1) -> list[RapidataOrder]:
107
- """Find orders by name. If name is not provided, it will return the most recent order.
110
+ def find_orders(self, name: str = "", amount: int = 1, latest=True) -> list[RapidataOrder]:
111
+ """Find your orders given criteria. If nothing is provided, it will return the most recent order.
108
112
 
109
113
  Args:
110
114
  name (str, optional): The name of the order - matching order will contain the name. Defaults to "" for any order.
111
115
  amount (int, optional): The amount of orders to return. Defaults to 1.
116
+ latest (bool, optional): If True, the most recent orders will be returned. If False, the oldest orders will be returned. Defaults to True.
112
117
 
113
118
  Returns:
114
119
  list[RapidataOrder]: A list of RapidataOrder instances.
@@ -116,9 +121,15 @@ class RapidataClient:
116
121
  try:
117
122
  order_page_result = self.openapi_service.order_api.order_query_get(QueryOrdersModel(
118
123
  page=PageInfo(index=1, size=amount),
119
- filter=RootFilter(filters=[Filter(field="OrderName", operator="Contains", value=name)])))
120
- except Exception:
121
- raise ValueError(f"Failed to find orders with name {name}.")
124
+ filter=RootFilter(filters=[Filter(field="OrderName", operator="Contains", value=name)]),
125
+ sortCriteria=[SortCriterion(direction="Desc" if latest else "Asc", propertyName="OrderDate")]
126
+ ))
127
+
128
+ except BadRequestException as e:
129
+ raise ValueError(f"Error occured during request. \nError: {e.body} \nTraceid: {e.headers.get('X-Trace-Id') if isinstance(e.headers, HTTPHeaderDict) else 'Unknown'}")
130
+
131
+ except Exception as e:
132
+ raise ValueError(f"Unknown error occured: {e}")
122
133
 
123
134
  orders = [self.get_order(order.id) for order in order_page_result.items]
124
135
  return orders
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: rapidata
3
- Version: 1.4.0
3
+ Version: 1.4.2
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
@@ -343,7 +343,7 @@ rapidata/rapidata_client/metadata/transcription_metadata.py,sha256=THtDEVCON4Ulc
343
343
  rapidata/rapidata_client/order/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
344
344
  rapidata/rapidata_client/order/rapidata_order.py,sha256=u0VhNgnbT0dn3AJiITqjtqn_OWgdwUcXrgU4iblPXZI,4663
345
345
  rapidata/rapidata_client/order/rapidata_order_builder.py,sha256=QvICzduLAuAkf8qFKxHV3zAag838WnV9lEzWdD4dxI0,15926
346
- rapidata/rapidata_client/rapidata_client.py,sha256=wZ-TANlm3ZNzTiYj6LXgYp5C9a0wkF0cAQcxRPp_TVg,6426
346
+ rapidata/rapidata_client/rapidata_client.py,sha256=bW1kwb3EYI5dYftrFoWnQ8bVncSFEzLJezUuRvvmHsU,7134
347
347
  rapidata/rapidata_client/referee/__init__.py,sha256=Ow9MQsONhF4sX2wFK9jbvSBrpcJgtq3OglIQMkBUdIY,167
348
348
  rapidata/rapidata_client/referee/base_referee.py,sha256=bMy7cw0a-pGNbFu6u_1_Jplu0A483Ubj4oDQzh8vu8k,493
349
349
  rapidata/rapidata_client/referee/classify_early_stopping_referee.py,sha256=B5wsqKM3_Oc1TU_MFGiIyiXjwK1LcmaVjhzLdaL8Cgw,1797
@@ -372,7 +372,7 @@ rapidata/service/local_file_service.py,sha256=pgorvlWcx52Uh3cEG6VrdMK_t__7dacQ_5
372
372
  rapidata/service/openapi_service.py,sha256=pGcOCttKZW0PVCSM7Kfehe5loh7CxmmDDbu4UJbamnI,2770
373
373
  rapidata/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
374
374
  rapidata/utils/image_utils.py,sha256=TldO3eJWG8IhfJjm5MfNGO0mEDm1mQTsRoA0HLU1Uxs,404
375
- rapidata-1.4.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
376
- rapidata-1.4.0.dist-info/METADATA,sha256=xP5dp4-r5EBQ1ZVDnEn1vFaMLY6_OO6TeXp0Fx0JxCo,1012
377
- rapidata-1.4.0.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
378
- rapidata-1.4.0.dist-info/RECORD,,
375
+ rapidata-1.4.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
376
+ rapidata-1.4.2.dist-info/METADATA,sha256=VwoDi4szkVcBk-fmrFJD9tKTD6wMzfyDGxpQQtlsACM,1012
377
+ rapidata-1.4.2.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
378
+ rapidata-1.4.2.dist-info/RECORD,,