label-studio-sdk 0.0.34__py3-none-any.whl → 1.0.1__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 label-studio-sdk might be problematic. Click here for more details.

Files changed (272) hide show
  1. label_studio_sdk/__init__.py +232 -9
  2. label_studio_sdk/_extensions/label_studio_tools/__init__.py +0 -0
  3. label_studio_sdk/_extensions/label_studio_tools/core/__init__.py +0 -0
  4. label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +163 -0
  5. label_studio_sdk/_extensions/label_studio_tools/core/utils/__init__.py +0 -0
  6. label_studio_sdk/_extensions/label_studio_tools/core/utils/exceptions.py +2 -0
  7. label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +228 -0
  8. label_studio_sdk/_extensions/label_studio_tools/core/utils/params.py +45 -0
  9. label_studio_sdk/_extensions/label_studio_tools/etl/__init__.py +1 -0
  10. label_studio_sdk/_extensions/label_studio_tools/etl/beam.py +34 -0
  11. label_studio_sdk/_extensions/label_studio_tools/etl/example.py +17 -0
  12. label_studio_sdk/_extensions/label_studio_tools/etl/registry.py +67 -0
  13. label_studio_sdk/_extensions/label_studio_tools/postprocessing/__init__.py +0 -0
  14. label_studio_sdk/_extensions/label_studio_tools/postprocessing/video.py +97 -0
  15. label_studio_sdk/_extensions/pager_ext.py +49 -0
  16. label_studio_sdk/_legacy/__init__.py +11 -0
  17. label_studio_sdk/_legacy/client.py +471 -0
  18. label_studio_sdk/_legacy/objects.py +74 -0
  19. label_studio_sdk/{project.py → _legacy/project.py} +2 -2
  20. label_studio_sdk/{schema → _legacy/schema}/label_config_schema.json +14 -14
  21. label_studio_sdk/actions/__init__.py +27 -0
  22. label_studio_sdk/actions/client.py +223 -0
  23. label_studio_sdk/actions/types/__init__.py +25 -0
  24. label_studio_sdk/actions/types/actions_create_request_filters.py +43 -0
  25. label_studio_sdk/actions/types/actions_create_request_filters_conjunction.py +5 -0
  26. label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +49 -0
  27. label_studio_sdk/actions/types/actions_create_request_filters_items_item_filter.py +31 -0
  28. label_studio_sdk/actions/types/actions_create_request_filters_items_item_operator.py +23 -0
  29. label_studio_sdk/actions/types/actions_create_request_id.py +19 -0
  30. label_studio_sdk/actions/types/actions_create_request_ordering_item.py +31 -0
  31. label_studio_sdk/actions/types/actions_create_request_selected_items.py +10 -0
  32. label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +39 -0
  33. label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +39 -0
  34. label_studio_sdk/annotations/__init__.py +2 -0
  35. label_studio_sdk/annotations/client.py +750 -0
  36. label_studio_sdk/base_client.py +183 -0
  37. label_studio_sdk/client.py +17 -463
  38. label_studio_sdk/converter/__init__.py +7 -0
  39. label_studio_sdk/converter/audio.py +56 -0
  40. label_studio_sdk/converter/brush.py +452 -0
  41. label_studio_sdk/converter/converter.py +1175 -0
  42. label_studio_sdk/converter/exports/__init__.py +0 -0
  43. label_studio_sdk/converter/exports/csv.py +82 -0
  44. label_studio_sdk/converter/exports/csv2.py +103 -0
  45. label_studio_sdk/converter/funsd.py +85 -0
  46. label_studio_sdk/converter/imports/__init__.py +0 -0
  47. label_studio_sdk/converter/imports/coco.py +314 -0
  48. label_studio_sdk/converter/imports/colors.py +198 -0
  49. label_studio_sdk/converter/imports/label_config.py +45 -0
  50. label_studio_sdk/converter/imports/pathtrack.py +269 -0
  51. label_studio_sdk/converter/imports/yolo.py +236 -0
  52. label_studio_sdk/converter/main.py +202 -0
  53. label_studio_sdk/converter/utils.py +473 -0
  54. label_studio_sdk/core/__init__.py +33 -0
  55. label_studio_sdk/core/api_error.py +15 -0
  56. label_studio_sdk/core/client_wrapper.py +55 -0
  57. label_studio_sdk/core/datetime_utils.py +28 -0
  58. label_studio_sdk/core/file.py +38 -0
  59. label_studio_sdk/core/http_client.py +447 -0
  60. label_studio_sdk/core/jsonable_encoder.py +99 -0
  61. label_studio_sdk/core/pagination.py +87 -0
  62. label_studio_sdk/core/pydantic_utilities.py +28 -0
  63. label_studio_sdk/core/query_encoder.py +33 -0
  64. label_studio_sdk/core/remove_none_from_dict.py +11 -0
  65. label_studio_sdk/core/request_options.py +32 -0
  66. label_studio_sdk/environment.py +7 -0
  67. label_studio_sdk/errors/__init__.py +6 -0
  68. label_studio_sdk/errors/bad_request_error.py +8 -0
  69. label_studio_sdk/errors/internal_server_error.py +8 -0
  70. label_studio_sdk/export_storage/__init__.py +28 -0
  71. label_studio_sdk/export_storage/azure/__init__.py +5 -0
  72. label_studio_sdk/export_storage/azure/client.py +888 -0
  73. label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
  74. label_studio_sdk/export_storage/azure/types/azure_create_response.py +67 -0
  75. label_studio_sdk/export_storage/azure/types/azure_update_response.py +67 -0
  76. label_studio_sdk/export_storage/client.py +107 -0
  77. label_studio_sdk/export_storage/gcs/__init__.py +5 -0
  78. label_studio_sdk/export_storage/gcs/client.py +888 -0
  79. label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
  80. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +67 -0
  81. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +67 -0
  82. label_studio_sdk/export_storage/local/__init__.py +5 -0
  83. label_studio_sdk/export_storage/local/client.py +834 -0
  84. label_studio_sdk/export_storage/local/types/__init__.py +6 -0
  85. label_studio_sdk/export_storage/local/types/local_create_response.py +57 -0
  86. label_studio_sdk/export_storage/local/types/local_update_response.py +57 -0
  87. label_studio_sdk/export_storage/redis/__init__.py +5 -0
  88. label_studio_sdk/export_storage/redis/client.py +918 -0
  89. label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
  90. label_studio_sdk/export_storage/redis/types/redis_create_response.py +72 -0
  91. label_studio_sdk/export_storage/redis/types/redis_update_response.py +72 -0
  92. label_studio_sdk/export_storage/s3/__init__.py +5 -0
  93. label_studio_sdk/export_storage/s3/client.py +1008 -0
  94. label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
  95. label_studio_sdk/export_storage/s3/types/s3create_response.py +89 -0
  96. label_studio_sdk/export_storage/s3/types/s3update_response.py +89 -0
  97. label_studio_sdk/export_storage/types/__init__.py +5 -0
  98. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +30 -0
  99. label_studio_sdk/files/__init__.py +2 -0
  100. label_studio_sdk/files/client.py +556 -0
  101. label_studio_sdk/import_storage/__init__.py +28 -0
  102. label_studio_sdk/import_storage/azure/__init__.py +5 -0
  103. label_studio_sdk/import_storage/azure/client.py +988 -0
  104. label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
  105. label_studio_sdk/import_storage/azure/types/azure_create_response.py +82 -0
  106. label_studio_sdk/import_storage/azure/types/azure_update_response.py +82 -0
  107. label_studio_sdk/import_storage/client.py +107 -0
  108. label_studio_sdk/import_storage/gcs/__init__.py +5 -0
  109. label_studio_sdk/import_storage/gcs/client.py +988 -0
  110. label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
  111. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +82 -0
  112. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +82 -0
  113. label_studio_sdk/import_storage/local/__init__.py +5 -0
  114. label_studio_sdk/import_storage/local/client.py +836 -0
  115. label_studio_sdk/import_storage/local/types/__init__.py +6 -0
  116. label_studio_sdk/import_storage/local/types/local_create_response.py +57 -0
  117. label_studio_sdk/import_storage/local/types/local_update_response.py +57 -0
  118. label_studio_sdk/import_storage/redis/__init__.py +5 -0
  119. label_studio_sdk/import_storage/redis/client.py +924 -0
  120. label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
  121. label_studio_sdk/import_storage/redis/types/redis_create_response.py +72 -0
  122. label_studio_sdk/import_storage/redis/types/redis_update_response.py +72 -0
  123. label_studio_sdk/import_storage/s3/__init__.py +5 -0
  124. label_studio_sdk/import_storage/s3/client.py +1138 -0
  125. label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
  126. label_studio_sdk/import_storage/s3/types/s3create_response.py +109 -0
  127. label_studio_sdk/import_storage/s3/types/s3update_response.py +109 -0
  128. label_studio_sdk/import_storage/types/__init__.py +5 -0
  129. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +30 -0
  130. label_studio_sdk/label_interface/base.py +10 -0
  131. label_studio_sdk/label_interface/control_tags.py +109 -71
  132. label_studio_sdk/label_interface/data_examples.json +96 -0
  133. label_studio_sdk/label_interface/interface.py +102 -53
  134. label_studio_sdk/label_interface/object_tags.py +8 -13
  135. label_studio_sdk/label_interface/region.py +33 -1
  136. label_studio_sdk/ml/__init__.py +19 -0
  137. label_studio_sdk/ml/client.py +981 -0
  138. label_studio_sdk/ml/types/__init__.py +17 -0
  139. label_studio_sdk/ml/types/ml_create_request_auth_method.py +5 -0
  140. label_studio_sdk/ml/types/ml_create_response.py +78 -0
  141. label_studio_sdk/ml/types/ml_create_response_auth_method.py +5 -0
  142. label_studio_sdk/ml/types/ml_update_request_auth_method.py +5 -0
  143. label_studio_sdk/ml/types/ml_update_response.py +78 -0
  144. label_studio_sdk/ml/types/ml_update_response_auth_method.py +5 -0
  145. label_studio_sdk/predictions/__init__.py +2 -0
  146. label_studio_sdk/predictions/client.py +638 -0
  147. label_studio_sdk/projects/__init__.py +6 -0
  148. label_studio_sdk/projects/client.py +1055 -0
  149. label_studio_sdk/projects/client_ext.py +19 -0
  150. label_studio_sdk/projects/exports/__init__.py +2 -0
  151. label_studio_sdk/projects/exports/client.py +930 -0
  152. label_studio_sdk/projects/types/__init__.py +7 -0
  153. label_studio_sdk/projects/types/projects_create_response.py +96 -0
  154. label_studio_sdk/projects/types/projects_import_tasks_response.py +71 -0
  155. label_studio_sdk/projects/types/projects_list_response.py +33 -0
  156. label_studio_sdk/py.typed +0 -0
  157. label_studio_sdk/tasks/__init__.py +5 -0
  158. label_studio_sdk/tasks/client.py +835 -0
  159. label_studio_sdk/tasks/client_ext.py +18 -0
  160. label_studio_sdk/tasks/types/__init__.py +6 -0
  161. label_studio_sdk/tasks/types/tasks_list_request_fields.py +5 -0
  162. label_studio_sdk/tasks/types/tasks_list_response.py +48 -0
  163. label_studio_sdk/types/__init__.py +115 -0
  164. label_studio_sdk/types/annotation.py +116 -0
  165. label_studio_sdk/types/annotation_filter_options.py +42 -0
  166. label_studio_sdk/types/annotation_last_action.py +19 -0
  167. label_studio_sdk/types/azure_blob_export_storage.py +112 -0
  168. label_studio_sdk/types/azure_blob_export_storage_status.py +7 -0
  169. label_studio_sdk/types/azure_blob_import_storage.py +113 -0
  170. label_studio_sdk/types/azure_blob_import_storage_status.py +7 -0
  171. label_studio_sdk/types/base_task.py +113 -0
  172. label_studio_sdk/types/base_user.py +42 -0
  173. label_studio_sdk/types/converted_format.py +36 -0
  174. label_studio_sdk/types/converted_format_status.py +5 -0
  175. label_studio_sdk/types/export.py +48 -0
  176. label_studio_sdk/types/export_convert.py +32 -0
  177. label_studio_sdk/types/export_create.py +54 -0
  178. label_studio_sdk/types/export_create_status.py +5 -0
  179. label_studio_sdk/types/export_status.py +5 -0
  180. label_studio_sdk/types/file_upload.py +30 -0
  181. label_studio_sdk/types/filter.py +53 -0
  182. label_studio_sdk/types/filter_group.py +35 -0
  183. label_studio_sdk/types/gcs_export_storage.py +112 -0
  184. label_studio_sdk/types/gcs_export_storage_status.py +7 -0
  185. label_studio_sdk/types/gcs_import_storage.py +113 -0
  186. label_studio_sdk/types/gcs_import_storage_status.py +7 -0
  187. label_studio_sdk/types/local_files_export_storage.py +97 -0
  188. label_studio_sdk/types/local_files_export_storage_status.py +7 -0
  189. label_studio_sdk/types/local_files_import_storage.py +92 -0
  190. label_studio_sdk/types/local_files_import_storage_status.py +7 -0
  191. label_studio_sdk/types/ml_backend.py +89 -0
  192. label_studio_sdk/types/ml_backend_auth_method.py +5 -0
  193. label_studio_sdk/types/ml_backend_state.py +5 -0
  194. label_studio_sdk/types/prediction.py +78 -0
  195. label_studio_sdk/types/project.py +198 -0
  196. label_studio_sdk/types/project_import.py +63 -0
  197. label_studio_sdk/types/project_import_status.py +5 -0
  198. label_studio_sdk/types/project_label_config.py +32 -0
  199. label_studio_sdk/types/project_sampling.py +7 -0
  200. label_studio_sdk/types/project_skip_queue.py +5 -0
  201. label_studio_sdk/types/redis_export_storage.py +117 -0
  202. label_studio_sdk/types/redis_export_storage_status.py +7 -0
  203. label_studio_sdk/types/redis_import_storage.py +112 -0
  204. label_studio_sdk/types/redis_import_storage_status.py +7 -0
  205. label_studio_sdk/types/s3export_storage.py +134 -0
  206. label_studio_sdk/types/s3export_storage_status.py +7 -0
  207. label_studio_sdk/types/s3import_storage.py +140 -0
  208. label_studio_sdk/types/s3import_storage_status.py +7 -0
  209. label_studio_sdk/types/serialization_option.py +36 -0
  210. label_studio_sdk/types/serialization_options.py +45 -0
  211. label_studio_sdk/types/task.py +157 -0
  212. label_studio_sdk/types/task_filter_options.py +49 -0
  213. label_studio_sdk/types/user_simple.py +37 -0
  214. label_studio_sdk/types/view.py +55 -0
  215. label_studio_sdk/types/webhook.py +67 -0
  216. label_studio_sdk/types/webhook_actions_item.py +21 -0
  217. label_studio_sdk/types/webhook_serializer_for_update.py +67 -0
  218. label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +21 -0
  219. label_studio_sdk/users/__init__.py +5 -0
  220. label_studio_sdk/users/client.py +830 -0
  221. label_studio_sdk/users/types/__init__.py +6 -0
  222. label_studio_sdk/users/types/users_get_token_response.py +36 -0
  223. label_studio_sdk/users/types/users_reset_token_response.py +36 -0
  224. label_studio_sdk/version.py +4 -0
  225. label_studio_sdk/views/__init__.py +35 -0
  226. label_studio_sdk/views/client.py +564 -0
  227. label_studio_sdk/views/types/__init__.py +33 -0
  228. label_studio_sdk/views/types/views_create_request_data.py +43 -0
  229. label_studio_sdk/views/types/views_create_request_data_filters.py +43 -0
  230. label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +5 -0
  231. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +49 -0
  232. label_studio_sdk/views/types/views_create_request_data_filters_items_item_filter.py +31 -0
  233. label_studio_sdk/views/types/views_create_request_data_filters_items_item_operator.py +23 -0
  234. label_studio_sdk/views/types/views_create_request_data_ordering_item.py +31 -0
  235. label_studio_sdk/views/types/views_update_request_data.py +43 -0
  236. label_studio_sdk/views/types/views_update_request_data_filters.py +43 -0
  237. label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +5 -0
  238. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +49 -0
  239. label_studio_sdk/views/types/views_update_request_data_filters_items_item_filter.py +31 -0
  240. label_studio_sdk/views/types/views_update_request_data_filters_items_item_operator.py +23 -0
  241. label_studio_sdk/views/types/views_update_request_data_ordering_item.py +31 -0
  242. label_studio_sdk/webhooks/__init__.py +5 -0
  243. label_studio_sdk/webhooks/client.py +636 -0
  244. label_studio_sdk/webhooks/types/__init__.py +5 -0
  245. label_studio_sdk/webhooks/types/webhooks_update_request_actions_item.py +21 -0
  246. label_studio_sdk-1.0.1.dist-info/METADATA +163 -0
  247. label_studio_sdk-1.0.1.dist-info/RECORD +256 -0
  248. {label_studio_sdk-0.0.34.dist-info → label_studio_sdk-1.0.1.dist-info}/WHEEL +1 -2
  249. label_studio_sdk/objects.py +0 -35
  250. label_studio_sdk-0.0.34.dist-info/LICENSE +0 -201
  251. label_studio_sdk-0.0.34.dist-info/METADATA +0 -24
  252. label_studio_sdk-0.0.34.dist-info/RECORD +0 -37
  253. label_studio_sdk-0.0.34.dist-info/top_level.txt +0 -2
  254. tests/test_client.py +0 -37
  255. tests/test_export.py +0 -105
  256. tests/test_interface/__init__.py +0 -1
  257. tests/test_interface/configs.py +0 -137
  258. tests/test_interface/mockups.py +0 -22
  259. tests/test_interface/test_compat.py +0 -64
  260. tests/test_interface/test_control_tags.py +0 -55
  261. tests/test_interface/test_data_generation.py +0 -45
  262. tests/test_interface/test_lpi.py +0 -15
  263. tests/test_interface/test_main.py +0 -196
  264. tests/test_interface/test_object_tags.py +0 -36
  265. tests/test_interface/test_region.py +0 -36
  266. tests/test_interface/test_validate_summary.py +0 -35
  267. tests/test_interface/test_validation.py +0 -59
  268. {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
  269. /label_studio_sdk/{exceptions.py → _legacy/exceptions.py} +0 -0
  270. /label_studio_sdk/{users.py → _legacy/users.py} +0 -0
  271. /label_studio_sdk/{utils.py → _legacy/utils.py} +0 -0
  272. /label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +0 -0
@@ -0,0 +1,835 @@
1
+ # This file was auto-generated by Fern from our API Definition.
2
+
3
+ import typing
4
+ from json.decoder import JSONDecodeError
5
+
6
+ from ..core.api_error import ApiError
7
+ from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
8
+ from ..core.jsonable_encoder import jsonable_encoder
9
+ from ..core.pagination import AsyncPager, SyncPager
10
+ from ..core.pydantic_utilities import pydantic_v1
11
+ from ..core.request_options import RequestOptions
12
+ from ..types.base_task import BaseTask
13
+ from ..types.project_import import ProjectImport
14
+ from ..types.task import Task
15
+ from .types.tasks_list_request_fields import TasksListRequestFields
16
+ from .types.tasks_list_response import TasksListResponse
17
+
18
+ # this is used as the default value for optional parameters
19
+ OMIT = typing.cast(typing.Any, ...)
20
+
21
+
22
+ class TasksClient:
23
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
24
+ self._client_wrapper = client_wrapper
25
+
26
+ def create_many_status(
27
+ self, id: int, import_pk: str, *, request_options: typing.Optional[RequestOptions] = None
28
+ ) -> ProjectImport:
29
+ """
30
+ Get information about an async project import operation. This can be especially useful to monitor status, as large import jobs can take time.
31
+
32
+ You will need the project ID and the unique ID of the import operation.
33
+
34
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
35
+
36
+ The import ID is returned as part of the response when you call [Import tasks](import-tasks).
37
+
38
+ Parameters
39
+ ----------
40
+ id : int
41
+ The project ID.
42
+
43
+ import_pk : str
44
+
45
+ request_options : typing.Optional[RequestOptions]
46
+ Request-specific configuration.
47
+
48
+ Returns
49
+ -------
50
+ ProjectImport
51
+
52
+
53
+ Examples
54
+ --------
55
+ from label_studio_sdk.client import LabelStudio
56
+
57
+ client = LabelStudio(
58
+ api_key="YOUR_API_KEY",
59
+ )
60
+ client.tasks.create_many_status(
61
+ id=1,
62
+ import_pk="import_pk",
63
+ )
64
+ """
65
+ _response = self._client_wrapper.httpx_client.request(
66
+ f"api/projects/{jsonable_encoder(id)}/imports/{jsonable_encoder(import_pk)}/",
67
+ method="GET",
68
+ request_options=request_options,
69
+ )
70
+ if 200 <= _response.status_code < 300:
71
+ return pydantic_v1.parse_obj_as(ProjectImport, _response.json()) # type: ignore
72
+ try:
73
+ _response_json = _response.json()
74
+ except JSONDecodeError:
75
+ raise ApiError(status_code=_response.status_code, body=_response.text)
76
+ raise ApiError(status_code=_response.status_code, body=_response_json)
77
+
78
+ def delete_all_tasks(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
79
+ """
80
+ Delete all tasks from a specific project.
81
+
82
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
83
+
84
+ Parameters
85
+ ----------
86
+ id : int
87
+ A unique integer value identifying this project.
88
+
89
+ request_options : typing.Optional[RequestOptions]
90
+ Request-specific configuration.
91
+
92
+ Returns
93
+ -------
94
+ None
95
+
96
+ Examples
97
+ --------
98
+ from label_studio_sdk.client import LabelStudio
99
+
100
+ client = LabelStudio(
101
+ api_key="YOUR_API_KEY",
102
+ )
103
+ client.tasks.delete_all_tasks(
104
+ id=1,
105
+ )
106
+ """
107
+ _response = self._client_wrapper.httpx_client.request(
108
+ f"api/projects/{jsonable_encoder(id)}/tasks/", method="DELETE", request_options=request_options
109
+ )
110
+ if 200 <= _response.status_code < 300:
111
+ return
112
+ try:
113
+ _response_json = _response.json()
114
+ except JSONDecodeError:
115
+ raise ApiError(status_code=_response.status_code, body=_response.text)
116
+ raise ApiError(status_code=_response.status_code, body=_response_json)
117
+
118
+ def list(
119
+ self,
120
+ *,
121
+ page: typing.Optional[int] = None,
122
+ page_size: typing.Optional[int] = None,
123
+ view: typing.Optional[int] = None,
124
+ project: typing.Optional[int] = None,
125
+ resolve_uri: typing.Optional[bool] = None,
126
+ fields: typing.Optional[TasksListRequestFields] = None,
127
+ review: typing.Optional[bool] = None,
128
+ include: typing.Optional[str] = None,
129
+ query: typing.Optional[str] = None,
130
+ request_options: typing.Optional[RequestOptions] = None,
131
+ ) -> SyncPager[Task]:
132
+ """
133
+ Retrieve a list of tasks.
134
+
135
+ You can use the query parameters to filter the list by project and/or view (a tab within the Data Manager). You can also optionally add pagination to make the response easier to parse.
136
+
137
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list). The view ID can be found using [List views](../views/list).
138
+
139
+ Parameters
140
+ ----------
141
+ page : typing.Optional[int]
142
+ A page number within the paginated result set.
143
+
144
+ page_size : typing.Optional[int]
145
+ Number of results to return per page.
146
+
147
+ view : typing.Optional[int]
148
+ View ID
149
+
150
+ project : typing.Optional[int]
151
+ Project ID
152
+
153
+ resolve_uri : typing.Optional[bool]
154
+ Resolve task data URIs using Cloud Storage
155
+
156
+ fields : typing.Optional[TasksListRequestFields]
157
+ Set to "all" if you want to include annotations and predictions in the response
158
+
159
+ review : typing.Optional[bool]
160
+ Get tasks for review
161
+
162
+ include : typing.Optional[str]
163
+ Specify which fields to include in the response
164
+
165
+ query : typing.Optional[str]
166
+ Additional query to filter tasks. It must be JSON encoded string of dict containing one of the following parameters: `{"filters": ..., "selectedItems": ..., "ordering": ...}`. Check Data Manager > Create View for more details about filters, selectedItems and ordering.
167
+
168
+ - **filters**: dict with `"conjunction"` string (`"or"` or `"and"`) and list of filters in `"items"` array. Each filter is a dictionary with keys: `"filter"`, `"operator"`, `"type"`, `"value"`. [Read more about available filters](https://labelstud.io/sdk/data_manager.html)<br/> Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
169
+ - **selectedItems**: dictionary with keys: `"all"`, `"included"`, `"excluded"`. If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br/> Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`
170
+ - **ordering**: list of fields to order by. Currently, ordering is supported by only one parameter. <br/>
171
+ Example: `["completed_at"]`
172
+
173
+ request_options : typing.Optional[RequestOptions]
174
+ Request-specific configuration.
175
+
176
+ Returns
177
+ -------
178
+ SyncPager[Task]
179
+ List of Tasks
180
+
181
+ Examples
182
+ --------
183
+ from label_studio_sdk.client import LabelStudio
184
+
185
+ client = LabelStudio(
186
+ api_key="YOUR_API_KEY",
187
+ )
188
+ client.tasks.list()
189
+ """
190
+ page = page or 1
191
+ _response = self._client_wrapper.httpx_client.request(
192
+ "api/tasks/",
193
+ method="GET",
194
+ params={
195
+ "page": page,
196
+ "page_size": page_size,
197
+ "view": view,
198
+ "project": project,
199
+ "resolve_uri": resolve_uri,
200
+ "fields": fields,
201
+ "review": review,
202
+ "include": include,
203
+ "query": query,
204
+ },
205
+ request_options=request_options,
206
+ )
207
+ if 200 <= _response.status_code < 300:
208
+ _parsed_response = pydantic_v1.parse_obj_as(TasksListResponse, _response.json()) # type: ignore
209
+ _has_next = True
210
+ _get_next = lambda: self.list(
211
+ page=page + 1,
212
+ page_size=page_size,
213
+ view=view,
214
+ project=project,
215
+ resolve_uri=resolve_uri,
216
+ fields=fields,
217
+ review=review,
218
+ include=include,
219
+ query=query,
220
+ request_options=request_options,
221
+ )
222
+ _items = _parsed_response.tasks
223
+ return SyncPager(has_next=_has_next, items=_items, get_next=_get_next)
224
+ try:
225
+ _response_json = _response.json()
226
+ except JSONDecodeError:
227
+ raise ApiError(status_code=_response.status_code, body=_response.text)
228
+ raise ApiError(status_code=_response.status_code, body=_response_json)
229
+
230
+ def create(
231
+ self,
232
+ *,
233
+ data: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
234
+ project: typing.Optional[int] = OMIT,
235
+ request_options: typing.Optional[RequestOptions] = None,
236
+ ) -> BaseTask:
237
+ """
238
+ Create a new labeling task in Label Studio.
239
+
240
+ The data you provide depends on your labeling config and data type.
241
+
242
+ You will also need to provide a project ID. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
243
+
244
+ Parameters
245
+ ----------
246
+ data : typing.Optional[typing.Dict[str, typing.Any]]
247
+ Task data dictionary with arbitrary keys and values
248
+
249
+ project : typing.Optional[int]
250
+ Project ID
251
+
252
+ request_options : typing.Optional[RequestOptions]
253
+ Request-specific configuration.
254
+
255
+ Returns
256
+ -------
257
+ BaseTask
258
+ Created task
259
+
260
+ Examples
261
+ --------
262
+ from label_studio_sdk.client import LabelStudio
263
+
264
+ client = LabelStudio(
265
+ api_key="YOUR_API_KEY",
266
+ )
267
+ client.tasks.create(
268
+ data={"image": "https://example.com/image.jpg", "text": "Hello, world!"},
269
+ project=1,
270
+ )
271
+ """
272
+ _response = self._client_wrapper.httpx_client.request(
273
+ "api/tasks/",
274
+ method="POST",
275
+ json={"data": data, "project": project},
276
+ request_options=request_options,
277
+ omit=OMIT,
278
+ )
279
+ if 200 <= _response.status_code < 300:
280
+ return pydantic_v1.parse_obj_as(BaseTask, _response.json()) # type: ignore
281
+ try:
282
+ _response_json = _response.json()
283
+ except JSONDecodeError:
284
+ raise ApiError(status_code=_response.status_code, body=_response.text)
285
+ raise ApiError(status_code=_response.status_code, body=_response_json)
286
+
287
+ def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BaseTask:
288
+ """
289
+ Get task data, metadata, annotations and other attributes for a specific labeling task by task ID.
290
+ The task ID is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
291
+
292
+ Parameters
293
+ ----------
294
+ id : str
295
+ Task ID
296
+
297
+ request_options : typing.Optional[RequestOptions]
298
+ Request-specific configuration.
299
+
300
+ Returns
301
+ -------
302
+ BaseTask
303
+ Task
304
+
305
+ Examples
306
+ --------
307
+ from label_studio_sdk.client import LabelStudio
308
+
309
+ client = LabelStudio(
310
+ api_key="YOUR_API_KEY",
311
+ )
312
+ client.tasks.get(
313
+ id="id",
314
+ )
315
+ """
316
+ _response = self._client_wrapper.httpx_client.request(
317
+ f"api/tasks/{jsonable_encoder(id)}/", method="GET", request_options=request_options
318
+ )
319
+ if 200 <= _response.status_code < 300:
320
+ return pydantic_v1.parse_obj_as(BaseTask, _response.json()) # type: ignore
321
+ try:
322
+ _response_json = _response.json()
323
+ except JSONDecodeError:
324
+ raise ApiError(status_code=_response.status_code, body=_response.text)
325
+ raise ApiError(status_code=_response.status_code, body=_response_json)
326
+
327
+ def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
328
+ """
329
+ Delete a task in Label Studio.
330
+
331
+ You will need the task ID. This is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
332
+
333
+ <Warning>This action cannot be undone.</Warning>
334
+
335
+ Parameters
336
+ ----------
337
+ id : str
338
+ Task ID
339
+
340
+ request_options : typing.Optional[RequestOptions]
341
+ Request-specific configuration.
342
+
343
+ Returns
344
+ -------
345
+ None
346
+
347
+ Examples
348
+ --------
349
+ from label_studio_sdk.client import LabelStudio
350
+
351
+ client = LabelStudio(
352
+ api_key="YOUR_API_KEY",
353
+ )
354
+ client.tasks.delete(
355
+ id="id",
356
+ )
357
+ """
358
+ _response = self._client_wrapper.httpx_client.request(
359
+ f"api/tasks/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
360
+ )
361
+ if 200 <= _response.status_code < 300:
362
+ return
363
+ try:
364
+ _response_json = _response.json()
365
+ except JSONDecodeError:
366
+ raise ApiError(status_code=_response.status_code, body=_response.text)
367
+ raise ApiError(status_code=_response.status_code, body=_response_json)
368
+
369
+ def update(
370
+ self,
371
+ id: str,
372
+ *,
373
+ data: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
374
+ project: typing.Optional[int] = OMIT,
375
+ request_options: typing.Optional[RequestOptions] = None,
376
+ ) -> BaseTask:
377
+ """
378
+ Update the attributes of an existing labeling task.
379
+
380
+ You will need the task ID. This is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
381
+
382
+ Parameters
383
+ ----------
384
+ id : str
385
+ Task ID
386
+
387
+ data : typing.Optional[typing.Dict[str, typing.Any]]
388
+ Task data dictionary with arbitrary keys and values
389
+
390
+ project : typing.Optional[int]
391
+ Project ID
392
+
393
+ request_options : typing.Optional[RequestOptions]
394
+ Request-specific configuration.
395
+
396
+ Returns
397
+ -------
398
+ BaseTask
399
+ Updated task
400
+
401
+ Examples
402
+ --------
403
+ from label_studio_sdk.client import LabelStudio
404
+
405
+ client = LabelStudio(
406
+ api_key="YOUR_API_KEY",
407
+ )
408
+ client.tasks.update(
409
+ id="id",
410
+ data={"image": "https://example.com/image.jpg", "text": "Hello, world!"},
411
+ project=1,
412
+ )
413
+ """
414
+ _response = self._client_wrapper.httpx_client.request(
415
+ f"api/tasks/{jsonable_encoder(id)}/",
416
+ method="PATCH",
417
+ json={"data": data, "project": project},
418
+ request_options=request_options,
419
+ omit=OMIT,
420
+ )
421
+ if 200 <= _response.status_code < 300:
422
+ return pydantic_v1.parse_obj_as(BaseTask, _response.json()) # type: ignore
423
+ try:
424
+ _response_json = _response.json()
425
+ except JSONDecodeError:
426
+ raise ApiError(status_code=_response.status_code, body=_response.text)
427
+ raise ApiError(status_code=_response.status_code, body=_response_json)
428
+
429
+
430
+ class AsyncTasksClient:
431
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
432
+ self._client_wrapper = client_wrapper
433
+
434
+ async def create_many_status(
435
+ self, id: int, import_pk: str, *, request_options: typing.Optional[RequestOptions] = None
436
+ ) -> ProjectImport:
437
+ """
438
+ Get information about an async project import operation. This can be especially useful to monitor status, as large import jobs can take time.
439
+
440
+ You will need the project ID and the unique ID of the import operation.
441
+
442
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
443
+
444
+ The import ID is returned as part of the response when you call [Import tasks](import-tasks).
445
+
446
+ Parameters
447
+ ----------
448
+ id : int
449
+ The project ID.
450
+
451
+ import_pk : str
452
+
453
+ request_options : typing.Optional[RequestOptions]
454
+ Request-specific configuration.
455
+
456
+ Returns
457
+ -------
458
+ ProjectImport
459
+
460
+
461
+ Examples
462
+ --------
463
+ from label_studio_sdk.client import AsyncLabelStudio
464
+
465
+ client = AsyncLabelStudio(
466
+ api_key="YOUR_API_KEY",
467
+ )
468
+ await client.tasks.create_many_status(
469
+ id=1,
470
+ import_pk="import_pk",
471
+ )
472
+ """
473
+ _response = await self._client_wrapper.httpx_client.request(
474
+ f"api/projects/{jsonable_encoder(id)}/imports/{jsonable_encoder(import_pk)}/",
475
+ method="GET",
476
+ request_options=request_options,
477
+ )
478
+ if 200 <= _response.status_code < 300:
479
+ return pydantic_v1.parse_obj_as(ProjectImport, _response.json()) # type: ignore
480
+ try:
481
+ _response_json = _response.json()
482
+ except JSONDecodeError:
483
+ raise ApiError(status_code=_response.status_code, body=_response.text)
484
+ raise ApiError(status_code=_response.status_code, body=_response_json)
485
+
486
+ async def delete_all_tasks(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
487
+ """
488
+ Delete all tasks from a specific project.
489
+
490
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
491
+
492
+ Parameters
493
+ ----------
494
+ id : int
495
+ A unique integer value identifying this project.
496
+
497
+ request_options : typing.Optional[RequestOptions]
498
+ Request-specific configuration.
499
+
500
+ Returns
501
+ -------
502
+ None
503
+
504
+ Examples
505
+ --------
506
+ from label_studio_sdk.client import AsyncLabelStudio
507
+
508
+ client = AsyncLabelStudio(
509
+ api_key="YOUR_API_KEY",
510
+ )
511
+ await client.tasks.delete_all_tasks(
512
+ id=1,
513
+ )
514
+ """
515
+ _response = await self._client_wrapper.httpx_client.request(
516
+ f"api/projects/{jsonable_encoder(id)}/tasks/", method="DELETE", request_options=request_options
517
+ )
518
+ if 200 <= _response.status_code < 300:
519
+ return
520
+ try:
521
+ _response_json = _response.json()
522
+ except JSONDecodeError:
523
+ raise ApiError(status_code=_response.status_code, body=_response.text)
524
+ raise ApiError(status_code=_response.status_code, body=_response_json)
525
+
526
+ async def list(
527
+ self,
528
+ *,
529
+ page: typing.Optional[int] = None,
530
+ page_size: typing.Optional[int] = None,
531
+ view: typing.Optional[int] = None,
532
+ project: typing.Optional[int] = None,
533
+ resolve_uri: typing.Optional[bool] = None,
534
+ fields: typing.Optional[TasksListRequestFields] = None,
535
+ review: typing.Optional[bool] = None,
536
+ include: typing.Optional[str] = None,
537
+ query: typing.Optional[str] = None,
538
+ request_options: typing.Optional[RequestOptions] = None,
539
+ ) -> AsyncPager[Task]:
540
+ """
541
+ Retrieve a list of tasks.
542
+
543
+ You can use the query parameters to filter the list by project and/or view (a tab within the Data Manager). You can also optionally add pagination to make the response easier to parse.
544
+
545
+ The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list). The view ID can be found using [List views](../views/list).
546
+
547
+ Parameters
548
+ ----------
549
+ page : typing.Optional[int]
550
+ A page number within the paginated result set.
551
+
552
+ page_size : typing.Optional[int]
553
+ Number of results to return per page.
554
+
555
+ view : typing.Optional[int]
556
+ View ID
557
+
558
+ project : typing.Optional[int]
559
+ Project ID
560
+
561
+ resolve_uri : typing.Optional[bool]
562
+ Resolve task data URIs using Cloud Storage
563
+
564
+ fields : typing.Optional[TasksListRequestFields]
565
+ Set to "all" if you want to include annotations and predictions in the response
566
+
567
+ review : typing.Optional[bool]
568
+ Get tasks for review
569
+
570
+ include : typing.Optional[str]
571
+ Specify which fields to include in the response
572
+
573
+ query : typing.Optional[str]
574
+ Additional query to filter tasks. It must be JSON encoded string of dict containing one of the following parameters: `{"filters": ..., "selectedItems": ..., "ordering": ...}`. Check Data Manager > Create View for more details about filters, selectedItems and ordering.
575
+
576
+ - **filters**: dict with `"conjunction"` string (`"or"` or `"and"`) and list of filters in `"items"` array. Each filter is a dictionary with keys: `"filter"`, `"operator"`, `"type"`, `"value"`. [Read more about available filters](https://labelstud.io/sdk/data_manager.html)<br/> Example: `{"conjunction": "or", "items": [{"filter": "filter:tasks:completed_at", "operator": "greater", "type": "Datetime", "value": "2021-01-01T00:00:00.000Z"}]}`
577
+ - **selectedItems**: dictionary with keys: `"all"`, `"included"`, `"excluded"`. If "all" is `false`, `"included"` must be used. If "all" is `true`, `"excluded"` must be used.<br/> Examples: `{"all": false, "included": [1, 2, 3]}` or `{"all": true, "excluded": [4, 5]}`
578
+ - **ordering**: list of fields to order by. Currently, ordering is supported by only one parameter. <br/>
579
+ Example: `["completed_at"]`
580
+
581
+ request_options : typing.Optional[RequestOptions]
582
+ Request-specific configuration.
583
+
584
+ Returns
585
+ -------
586
+ AsyncPager[Task]
587
+ List of Tasks
588
+
589
+ Examples
590
+ --------
591
+ from label_studio_sdk.client import AsyncLabelStudio
592
+
593
+ client = AsyncLabelStudio(
594
+ api_key="YOUR_API_KEY",
595
+ )
596
+ await client.tasks.list()
597
+ """
598
+ page = page or 1
599
+ _response = await self._client_wrapper.httpx_client.request(
600
+ "api/tasks/",
601
+ method="GET",
602
+ params={
603
+ "page": page,
604
+ "page_size": page_size,
605
+ "view": view,
606
+ "project": project,
607
+ "resolve_uri": resolve_uri,
608
+ "fields": fields,
609
+ "review": review,
610
+ "include": include,
611
+ "query": query,
612
+ },
613
+ request_options=request_options,
614
+ )
615
+ if 200 <= _response.status_code < 300:
616
+ _parsed_response = pydantic_v1.parse_obj_as(TasksListResponse, _response.json()) # type: ignore
617
+ _has_next = True
618
+ _get_next = lambda: self.list(
619
+ page=page + 1,
620
+ page_size=page_size,
621
+ view=view,
622
+ project=project,
623
+ resolve_uri=resolve_uri,
624
+ fields=fields,
625
+ review=review,
626
+ include=include,
627
+ query=query,
628
+ request_options=request_options,
629
+ )
630
+ _items = _parsed_response.tasks
631
+ return AsyncPager(has_next=_has_next, items=_items, get_next=_get_next)
632
+ try:
633
+ _response_json = _response.json()
634
+ except JSONDecodeError:
635
+ raise ApiError(status_code=_response.status_code, body=_response.text)
636
+ raise ApiError(status_code=_response.status_code, body=_response_json)
637
+
638
+ async def create(
639
+ self,
640
+ *,
641
+ data: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
642
+ project: typing.Optional[int] = OMIT,
643
+ request_options: typing.Optional[RequestOptions] = None,
644
+ ) -> BaseTask:
645
+ """
646
+ Create a new labeling task in Label Studio.
647
+
648
+ The data you provide depends on your labeling config and data type.
649
+
650
+ You will also need to provide a project ID. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../projects/list).
651
+
652
+ Parameters
653
+ ----------
654
+ data : typing.Optional[typing.Dict[str, typing.Any]]
655
+ Task data dictionary with arbitrary keys and values
656
+
657
+ project : typing.Optional[int]
658
+ Project ID
659
+
660
+ request_options : typing.Optional[RequestOptions]
661
+ Request-specific configuration.
662
+
663
+ Returns
664
+ -------
665
+ BaseTask
666
+ Created task
667
+
668
+ Examples
669
+ --------
670
+ from label_studio_sdk.client import AsyncLabelStudio
671
+
672
+ client = AsyncLabelStudio(
673
+ api_key="YOUR_API_KEY",
674
+ )
675
+ await client.tasks.create(
676
+ data={"image": "https://example.com/image.jpg", "text": "Hello, world!"},
677
+ project=1,
678
+ )
679
+ """
680
+ _response = await self._client_wrapper.httpx_client.request(
681
+ "api/tasks/",
682
+ method="POST",
683
+ json={"data": data, "project": project},
684
+ request_options=request_options,
685
+ omit=OMIT,
686
+ )
687
+ if 200 <= _response.status_code < 300:
688
+ return pydantic_v1.parse_obj_as(BaseTask, _response.json()) # type: ignore
689
+ try:
690
+ _response_json = _response.json()
691
+ except JSONDecodeError:
692
+ raise ApiError(status_code=_response.status_code, body=_response.text)
693
+ raise ApiError(status_code=_response.status_code, body=_response_json)
694
+
695
+ async def get(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> BaseTask:
696
+ """
697
+ Get task data, metadata, annotations and other attributes for a specific labeling task by task ID.
698
+ The task ID is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
699
+
700
+ Parameters
701
+ ----------
702
+ id : str
703
+ Task ID
704
+
705
+ request_options : typing.Optional[RequestOptions]
706
+ Request-specific configuration.
707
+
708
+ Returns
709
+ -------
710
+ BaseTask
711
+ Task
712
+
713
+ Examples
714
+ --------
715
+ from label_studio_sdk.client import AsyncLabelStudio
716
+
717
+ client = AsyncLabelStudio(
718
+ api_key="YOUR_API_KEY",
719
+ )
720
+ await client.tasks.get(
721
+ id="id",
722
+ )
723
+ """
724
+ _response = await self._client_wrapper.httpx_client.request(
725
+ f"api/tasks/{jsonable_encoder(id)}/", method="GET", request_options=request_options
726
+ )
727
+ if 200 <= _response.status_code < 300:
728
+ return pydantic_v1.parse_obj_as(BaseTask, _response.json()) # type: ignore
729
+ try:
730
+ _response_json = _response.json()
731
+ except JSONDecodeError:
732
+ raise ApiError(status_code=_response.status_code, body=_response.text)
733
+ raise ApiError(status_code=_response.status_code, body=_response_json)
734
+
735
+ async def delete(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
736
+ """
737
+ Delete a task in Label Studio.
738
+
739
+ You will need the task ID. This is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
740
+
741
+ <Warning>This action cannot be undone.</Warning>
742
+
743
+ Parameters
744
+ ----------
745
+ id : str
746
+ Task ID
747
+
748
+ request_options : typing.Optional[RequestOptions]
749
+ Request-specific configuration.
750
+
751
+ Returns
752
+ -------
753
+ None
754
+
755
+ Examples
756
+ --------
757
+ from label_studio_sdk.client import AsyncLabelStudio
758
+
759
+ client = AsyncLabelStudio(
760
+ api_key="YOUR_API_KEY",
761
+ )
762
+ await client.tasks.delete(
763
+ id="id",
764
+ )
765
+ """
766
+ _response = await self._client_wrapper.httpx_client.request(
767
+ f"api/tasks/{jsonable_encoder(id)}/", method="DELETE", request_options=request_options
768
+ )
769
+ if 200 <= _response.status_code < 300:
770
+ return
771
+ try:
772
+ _response_json = _response.json()
773
+ except JSONDecodeError:
774
+ raise ApiError(status_code=_response.status_code, body=_response.text)
775
+ raise ApiError(status_code=_response.status_code, body=_response_json)
776
+
777
+ async def update(
778
+ self,
779
+ id: str,
780
+ *,
781
+ data: typing.Optional[typing.Dict[str, typing.Any]] = OMIT,
782
+ project: typing.Optional[int] = OMIT,
783
+ request_options: typing.Optional[RequestOptions] = None,
784
+ ) -> BaseTask:
785
+ """
786
+ Update the attributes of an existing labeling task.
787
+
788
+ You will need the task ID. This is available from the Label Studio URL when viewing the task, or you can retrieve it programmatically with [Get task list](list).
789
+
790
+ Parameters
791
+ ----------
792
+ id : str
793
+ Task ID
794
+
795
+ data : typing.Optional[typing.Dict[str, typing.Any]]
796
+ Task data dictionary with arbitrary keys and values
797
+
798
+ project : typing.Optional[int]
799
+ Project ID
800
+
801
+ request_options : typing.Optional[RequestOptions]
802
+ Request-specific configuration.
803
+
804
+ Returns
805
+ -------
806
+ BaseTask
807
+ Updated task
808
+
809
+ Examples
810
+ --------
811
+ from label_studio_sdk.client import AsyncLabelStudio
812
+
813
+ client = AsyncLabelStudio(
814
+ api_key="YOUR_API_KEY",
815
+ )
816
+ await client.tasks.update(
817
+ id="id",
818
+ data={"image": "https://example.com/image.jpg", "text": "Hello, world!"},
819
+ project=1,
820
+ )
821
+ """
822
+ _response = await self._client_wrapper.httpx_client.request(
823
+ f"api/tasks/{jsonable_encoder(id)}/",
824
+ method="PATCH",
825
+ json={"data": data, "project": project},
826
+ request_options=request_options,
827
+ omit=OMIT,
828
+ )
829
+ if 200 <= _response.status_code < 300:
830
+ return pydantic_v1.parse_obj_as(BaseTask, _response.json()) # type: ignore
831
+ try:
832
+ _response_json = _response.json()
833
+ except JSONDecodeError:
834
+ raise ApiError(status_code=_response.status_code, body=_response.text)
835
+ raise ApiError(status_code=_response.status_code, body=_response_json)