label-studio-sdk 0.0.34__py3-none-any.whl → 1.0.0__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.
Files changed (256) hide show
  1. label_studio_sdk/__init__.py +206 -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/_legacy/__init__.py +11 -0
  16. label_studio_sdk/_legacy/client.py +471 -0
  17. label_studio_sdk/_legacy/label_interface/data_examples.json +96 -0
  18. label_studio_sdk/{label_interface → _legacy/label_interface}/interface.py +9 -6
  19. label_studio_sdk/{project.py → _legacy/project.py} +2 -2
  20. label_studio_sdk/actions/__init__.py +2 -0
  21. label_studio_sdk/actions/client.py +150 -0
  22. label_studio_sdk/annotations/__init__.py +2 -0
  23. label_studio_sdk/annotations/client.py +750 -0
  24. label_studio_sdk/client.py +162 -450
  25. label_studio_sdk/converter/__init__.py +7 -0
  26. label_studio_sdk/converter/audio.py +56 -0
  27. label_studio_sdk/converter/brush.py +452 -0
  28. label_studio_sdk/converter/converter.py +1175 -0
  29. label_studio_sdk/converter/exports/__init__.py +0 -0
  30. label_studio_sdk/converter/exports/csv.py +82 -0
  31. label_studio_sdk/converter/exports/csv2.py +103 -0
  32. label_studio_sdk/converter/funsd.py +85 -0
  33. label_studio_sdk/converter/imports/__init__.py +0 -0
  34. label_studio_sdk/converter/imports/coco.py +314 -0
  35. label_studio_sdk/converter/imports/colors.py +198 -0
  36. label_studio_sdk/converter/imports/label_config.py +45 -0
  37. label_studio_sdk/converter/imports/pathtrack.py +269 -0
  38. label_studio_sdk/converter/imports/yolo.py +236 -0
  39. label_studio_sdk/converter/main.py +202 -0
  40. label_studio_sdk/converter/utils.py +473 -0
  41. label_studio_sdk/core/__init__.py +33 -0
  42. label_studio_sdk/core/api_error.py +15 -0
  43. label_studio_sdk/core/client_wrapper.py +55 -0
  44. label_studio_sdk/core/datetime_utils.py +28 -0
  45. label_studio_sdk/core/file.py +38 -0
  46. label_studio_sdk/core/http_client.py +443 -0
  47. label_studio_sdk/core/jsonable_encoder.py +99 -0
  48. label_studio_sdk/core/pagination.py +87 -0
  49. label_studio_sdk/core/pydantic_utilities.py +28 -0
  50. label_studio_sdk/core/query_encoder.py +33 -0
  51. label_studio_sdk/core/remove_none_from_dict.py +11 -0
  52. label_studio_sdk/core/request_options.py +32 -0
  53. label_studio_sdk/environment.py +7 -0
  54. label_studio_sdk/errors/__init__.py +6 -0
  55. label_studio_sdk/errors/bad_request_error.py +8 -0
  56. label_studio_sdk/errors/internal_server_error.py +8 -0
  57. label_studio_sdk/export_storage/__init__.py +28 -0
  58. label_studio_sdk/export_storage/azure/__init__.py +5 -0
  59. label_studio_sdk/export_storage/azure/client.py +722 -0
  60. label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
  61. label_studio_sdk/export_storage/azure/types/azure_create_response.py +52 -0
  62. label_studio_sdk/export_storage/azure/types/azure_update_response.py +52 -0
  63. label_studio_sdk/export_storage/client.py +107 -0
  64. label_studio_sdk/export_storage/gcs/__init__.py +5 -0
  65. label_studio_sdk/export_storage/gcs/client.py +722 -0
  66. label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
  67. label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +52 -0
  68. label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +52 -0
  69. label_studio_sdk/export_storage/local/__init__.py +5 -0
  70. label_studio_sdk/export_storage/local/client.py +688 -0
  71. label_studio_sdk/export_storage/local/types/__init__.py +6 -0
  72. label_studio_sdk/export_storage/local/types/local_create_response.py +47 -0
  73. label_studio_sdk/export_storage/local/types/local_update_response.py +47 -0
  74. label_studio_sdk/export_storage/redis/__init__.py +5 -0
  75. label_studio_sdk/export_storage/redis/client.py +714 -0
  76. label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
  77. label_studio_sdk/export_storage/redis/types/redis_create_response.py +57 -0
  78. label_studio_sdk/export_storage/redis/types/redis_update_response.py +57 -0
  79. label_studio_sdk/export_storage/s3/__init__.py +5 -0
  80. label_studio_sdk/export_storage/s3/client.py +820 -0
  81. label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
  82. label_studio_sdk/export_storage/s3/types/s3create_response.py +74 -0
  83. label_studio_sdk/export_storage/s3/types/s3update_response.py +74 -0
  84. label_studio_sdk/export_storage/types/__init__.py +5 -0
  85. label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +30 -0
  86. label_studio_sdk/files/__init__.py +2 -0
  87. label_studio_sdk/files/client.py +556 -0
  88. label_studio_sdk/import_storage/__init__.py +28 -0
  89. label_studio_sdk/import_storage/azure/__init__.py +5 -0
  90. label_studio_sdk/import_storage/azure/client.py +812 -0
  91. label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
  92. label_studio_sdk/import_storage/azure/types/azure_create_response.py +72 -0
  93. label_studio_sdk/import_storage/azure/types/azure_update_response.py +72 -0
  94. label_studio_sdk/import_storage/client.py +107 -0
  95. label_studio_sdk/import_storage/gcs/__init__.py +5 -0
  96. label_studio_sdk/import_storage/gcs/client.py +812 -0
  97. label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
  98. label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +72 -0
  99. label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +72 -0
  100. label_studio_sdk/import_storage/local/__init__.py +5 -0
  101. label_studio_sdk/import_storage/local/client.py +690 -0
  102. label_studio_sdk/import_storage/local/types/__init__.py +6 -0
  103. label_studio_sdk/import_storage/local/types/local_create_response.py +47 -0
  104. label_studio_sdk/import_storage/local/types/local_update_response.py +47 -0
  105. label_studio_sdk/import_storage/redis/__init__.py +5 -0
  106. label_studio_sdk/import_storage/redis/client.py +768 -0
  107. label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
  108. label_studio_sdk/import_storage/redis/types/redis_create_response.py +62 -0
  109. label_studio_sdk/import_storage/redis/types/redis_update_response.py +62 -0
  110. label_studio_sdk/import_storage/s3/__init__.py +5 -0
  111. label_studio_sdk/import_storage/s3/client.py +912 -0
  112. label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
  113. label_studio_sdk/import_storage/s3/types/s3create_response.py +99 -0
  114. label_studio_sdk/import_storage/s3/types/s3update_response.py +99 -0
  115. label_studio_sdk/import_storage/types/__init__.py +5 -0
  116. label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +30 -0
  117. label_studio_sdk/ml/__init__.py +19 -0
  118. label_studio_sdk/ml/client.py +981 -0
  119. label_studio_sdk/ml/types/__init__.py +17 -0
  120. label_studio_sdk/ml/types/ml_create_request_auth_method.py +5 -0
  121. label_studio_sdk/ml/types/ml_create_response.py +78 -0
  122. label_studio_sdk/ml/types/ml_create_response_auth_method.py +5 -0
  123. label_studio_sdk/ml/types/ml_update_request_auth_method.py +5 -0
  124. label_studio_sdk/ml/types/ml_update_response.py +78 -0
  125. label_studio_sdk/ml/types/ml_update_response_auth_method.py +5 -0
  126. label_studio_sdk/predictions/__init__.py +2 -0
  127. label_studio_sdk/predictions/client.py +638 -0
  128. label_studio_sdk/projects/__init__.py +6 -0
  129. label_studio_sdk/projects/client.py +1053 -0
  130. label_studio_sdk/projects/exports/__init__.py +2 -0
  131. label_studio_sdk/projects/exports/client.py +930 -0
  132. label_studio_sdk/projects/types/__init__.py +7 -0
  133. label_studio_sdk/projects/types/projects_create_response.py +96 -0
  134. label_studio_sdk/projects/types/projects_import_tasks_response.py +71 -0
  135. label_studio_sdk/projects/types/projects_list_response.py +33 -0
  136. label_studio_sdk/py.typed +0 -0
  137. label_studio_sdk/tasks/__init__.py +5 -0
  138. label_studio_sdk/tasks/client.py +811 -0
  139. label_studio_sdk/tasks/types/__init__.py +6 -0
  140. label_studio_sdk/tasks/types/tasks_list_request_fields.py +5 -0
  141. label_studio_sdk/tasks/types/tasks_list_response.py +48 -0
  142. label_studio_sdk/types/__init__.py +115 -0
  143. label_studio_sdk/types/annotation.py +116 -0
  144. label_studio_sdk/types/annotation_filter_options.py +42 -0
  145. label_studio_sdk/types/annotation_last_action.py +19 -0
  146. label_studio_sdk/types/azure_blob_export_storage.py +112 -0
  147. label_studio_sdk/types/azure_blob_export_storage_status.py +7 -0
  148. label_studio_sdk/types/azure_blob_import_storage.py +113 -0
  149. label_studio_sdk/types/azure_blob_import_storage_status.py +7 -0
  150. label_studio_sdk/types/base_task.py +113 -0
  151. label_studio_sdk/types/base_user.py +42 -0
  152. label_studio_sdk/types/converted_format.py +36 -0
  153. label_studio_sdk/types/converted_format_status.py +5 -0
  154. label_studio_sdk/types/export.py +48 -0
  155. label_studio_sdk/types/export_convert.py +32 -0
  156. label_studio_sdk/types/export_create.py +54 -0
  157. label_studio_sdk/types/export_create_status.py +5 -0
  158. label_studio_sdk/types/export_status.py +5 -0
  159. label_studio_sdk/types/file_upload.py +30 -0
  160. label_studio_sdk/types/filter.py +53 -0
  161. label_studio_sdk/types/filter_group.py +35 -0
  162. label_studio_sdk/types/gcs_export_storage.py +112 -0
  163. label_studio_sdk/types/gcs_export_storage_status.py +7 -0
  164. label_studio_sdk/types/gcs_import_storage.py +113 -0
  165. label_studio_sdk/types/gcs_import_storage_status.py +7 -0
  166. label_studio_sdk/types/local_files_export_storage.py +97 -0
  167. label_studio_sdk/types/local_files_export_storage_status.py +7 -0
  168. label_studio_sdk/types/local_files_import_storage.py +92 -0
  169. label_studio_sdk/types/local_files_import_storage_status.py +7 -0
  170. label_studio_sdk/types/ml_backend.py +89 -0
  171. label_studio_sdk/types/ml_backend_auth_method.py +5 -0
  172. label_studio_sdk/types/ml_backend_state.py +5 -0
  173. label_studio_sdk/types/prediction.py +78 -0
  174. label_studio_sdk/types/project.py +198 -0
  175. label_studio_sdk/types/project_import.py +63 -0
  176. label_studio_sdk/types/project_import_status.py +5 -0
  177. label_studio_sdk/types/project_label_config.py +32 -0
  178. label_studio_sdk/types/project_sampling.py +7 -0
  179. label_studio_sdk/types/project_skip_queue.py +5 -0
  180. label_studio_sdk/types/redis_export_storage.py +117 -0
  181. label_studio_sdk/types/redis_export_storage_status.py +7 -0
  182. label_studio_sdk/types/redis_import_storage.py +112 -0
  183. label_studio_sdk/types/redis_import_storage_status.py +7 -0
  184. label_studio_sdk/types/s3export_storage.py +134 -0
  185. label_studio_sdk/types/s3export_storage_status.py +7 -0
  186. label_studio_sdk/types/s3import_storage.py +140 -0
  187. label_studio_sdk/types/s3import_storage_status.py +7 -0
  188. label_studio_sdk/types/serialization_option.py +36 -0
  189. label_studio_sdk/types/serialization_options.py +45 -0
  190. label_studio_sdk/types/task.py +157 -0
  191. label_studio_sdk/types/task_filter_options.py +49 -0
  192. label_studio_sdk/types/user_simple.py +37 -0
  193. label_studio_sdk/types/view.py +55 -0
  194. label_studio_sdk/types/webhook.py +67 -0
  195. label_studio_sdk/types/webhook_actions_item.py +21 -0
  196. label_studio_sdk/types/webhook_serializer_for_update.py +67 -0
  197. label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +21 -0
  198. label_studio_sdk/users/__init__.py +5 -0
  199. label_studio_sdk/users/client.py +830 -0
  200. label_studio_sdk/users/types/__init__.py +6 -0
  201. label_studio_sdk/users/types/users_get_token_response.py +36 -0
  202. label_studio_sdk/users/types/users_reset_token_response.py +36 -0
  203. label_studio_sdk/version.py +4 -0
  204. label_studio_sdk/views/__init__.py +31 -0
  205. label_studio_sdk/views/client.py +564 -0
  206. label_studio_sdk/views/types/__init__.py +29 -0
  207. label_studio_sdk/views/types/views_create_request_data.py +43 -0
  208. label_studio_sdk/views/types/views_create_request_data_filters.py +43 -0
  209. label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +5 -0
  210. label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +47 -0
  211. label_studio_sdk/views/types/views_create_request_data_ordering_item.py +38 -0
  212. label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +5 -0
  213. label_studio_sdk/views/types/views_update_request_data.py +43 -0
  214. label_studio_sdk/views/types/views_update_request_data_filters.py +43 -0
  215. label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +5 -0
  216. label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +47 -0
  217. label_studio_sdk/views/types/views_update_request_data_ordering_item.py +38 -0
  218. label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +5 -0
  219. label_studio_sdk/webhooks/__init__.py +5 -0
  220. label_studio_sdk/webhooks/client.py +636 -0
  221. label_studio_sdk/webhooks/types/__init__.py +5 -0
  222. label_studio_sdk/webhooks/types/webhooks_update_request_actions_item.py +21 -0
  223. label_studio_sdk-1.0.0.dist-info/METADATA +307 -0
  224. label_studio_sdk-1.0.0.dist-info/RECORD +239 -0
  225. {label_studio_sdk-0.0.34.dist-info → label_studio_sdk-1.0.0.dist-info}/WHEEL +1 -2
  226. label_studio_sdk-0.0.34.dist-info/LICENSE +0 -201
  227. label_studio_sdk-0.0.34.dist-info/METADATA +0 -24
  228. label_studio_sdk-0.0.34.dist-info/RECORD +0 -37
  229. label_studio_sdk-0.0.34.dist-info/top_level.txt +0 -2
  230. tests/test_client.py +0 -37
  231. tests/test_export.py +0 -105
  232. tests/test_interface/__init__.py +0 -1
  233. tests/test_interface/configs.py +0 -137
  234. tests/test_interface/mockups.py +0 -22
  235. tests/test_interface/test_compat.py +0 -64
  236. tests/test_interface/test_control_tags.py +0 -55
  237. tests/test_interface/test_data_generation.py +0 -45
  238. tests/test_interface/test_lpi.py +0 -15
  239. tests/test_interface/test_main.py +0 -196
  240. tests/test_interface/test_object_tags.py +0 -36
  241. tests/test_interface/test_region.py +0 -36
  242. tests/test_interface/test_validate_summary.py +0 -35
  243. tests/test_interface/test_validation.py +0 -59
  244. {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
  245. /label_studio_sdk/{exceptions.py → _legacy/exceptions.py} +0 -0
  246. /label_studio_sdk/{label_interface → _legacy/label_interface}/__init__.py +0 -0
  247. /label_studio_sdk/{label_interface → _legacy/label_interface}/base.py +0 -0
  248. /label_studio_sdk/{label_interface → _legacy/label_interface}/control_tags.py +0 -0
  249. /label_studio_sdk/{label_interface → _legacy/label_interface}/label_tags.py +0 -0
  250. /label_studio_sdk/{label_interface → _legacy/label_interface}/object_tags.py +0 -0
  251. /label_studio_sdk/{label_interface → _legacy/label_interface}/region.py +0 -0
  252. /label_studio_sdk/{objects.py → _legacy/objects.py} +0 -0
  253. /label_studio_sdk/{schema → _legacy/schema}/label_config_schema.json +0 -0
  254. /label_studio_sdk/{users.py → _legacy/users.py} +0 -0
  255. /label_studio_sdk/{utils.py → _legacy/utils.py} +0 -0
  256. /label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +0 -0
@@ -0,0 +1,722 @@
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.pydantic_utilities import pydantic_v1
10
+ from ...core.request_options import RequestOptions
11
+ from ...types.azure_blob_export_storage import AzureBlobExportStorage
12
+ from .types.azure_create_response import AzureCreateResponse
13
+ from .types.azure_update_response import AzureUpdateResponse
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class AzureClient:
20
+ def __init__(self, *, client_wrapper: SyncClientWrapper):
21
+ self._client_wrapper = client_wrapper
22
+
23
+ def list(
24
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
25
+ ) -> typing.List[AzureBlobExportStorage]:
26
+ """
27
+ You can connect your Microsoft Azure Blob storage container to Label Studio as a source storage or target storage. Use this API request to get a list of all Azure export (target) storage connections for a specific project.
28
+
29
+ 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).
30
+
31
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
32
+
33
+ Parameters
34
+ ----------
35
+ project : typing.Optional[int]
36
+ Project ID
37
+
38
+ request_options : typing.Optional[RequestOptions]
39
+ Request-specific configuration.
40
+
41
+ Returns
42
+ -------
43
+ typing.List[AzureBlobExportStorage]
44
+
45
+
46
+ Examples
47
+ --------
48
+ from label_studio_sdk.client import LabelStudio
49
+
50
+ client = LabelStudio(
51
+ api_key="YOUR_API_KEY",
52
+ )
53
+ client.export_storage.azure.list()
54
+ """
55
+ _response = self._client_wrapper.httpx_client.request(
56
+ "api/storages/export/azure", method="GET", params={"project": project}, request_options=request_options
57
+ )
58
+ if 200 <= _response.status_code < 300:
59
+ return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
60
+ try:
61
+ _response_json = _response.json()
62
+ except JSONDecodeError:
63
+ raise ApiError(status_code=_response.status_code, body=_response.text)
64
+ raise ApiError(status_code=_response.status_code, body=_response_json)
65
+
66
+ def create(
67
+ self,
68
+ *,
69
+ project: typing.Optional[int] = OMIT,
70
+ container: typing.Optional[str] = OMIT,
71
+ prefix: typing.Optional[str] = OMIT,
72
+ account_name: typing.Optional[str] = OMIT,
73
+ account_key: typing.Optional[str] = OMIT,
74
+ request_options: typing.Optional[RequestOptions] = None,
75
+ ) -> AzureCreateResponse:
76
+ """
77
+ Create a new target storage connection to Microsoft Azure Blob storage.
78
+
79
+ For information about the required fields and prerequisites, see [Microsoft Azure Blob storage](https://labelstud.io/guide/storage#Microsoft-Azure-Blob-storage) in the Label Studio documentation.
80
+
81
+ <Tip>After you add the storage, you should validate the connection before attempting to sync your data. Your data will not be exported until you [sync your connection](sync).</Tip>
82
+
83
+ Parameters
84
+ ----------
85
+ project : typing.Optional[int]
86
+ Project ID
87
+
88
+ container : typing.Optional[str]
89
+ Azure blob container
90
+
91
+ prefix : typing.Optional[str]
92
+ Azure blob prefix name
93
+
94
+ account_name : typing.Optional[str]
95
+ Azure Blob account name
96
+
97
+ account_key : typing.Optional[str]
98
+ Azure Blob account key
99
+
100
+ request_options : typing.Optional[RequestOptions]
101
+ Request-specific configuration.
102
+
103
+ Returns
104
+ -------
105
+ AzureCreateResponse
106
+
107
+
108
+ Examples
109
+ --------
110
+ from label_studio_sdk.client import LabelStudio
111
+
112
+ client = LabelStudio(
113
+ api_key="YOUR_API_KEY",
114
+ )
115
+ client.export_storage.azure.create()
116
+ """
117
+ _response = self._client_wrapper.httpx_client.request(
118
+ "api/storages/export/azure",
119
+ method="POST",
120
+ json={
121
+ "project": project,
122
+ "container": container,
123
+ "prefix": prefix,
124
+ "account_name": account_name,
125
+ "account_key": account_key,
126
+ },
127
+ request_options=request_options,
128
+ omit=OMIT,
129
+ )
130
+ if 200 <= _response.status_code < 300:
131
+ return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
132
+ try:
133
+ _response_json = _response.json()
134
+ except JSONDecodeError:
135
+ raise ApiError(status_code=_response.status_code, body=_response.text)
136
+ raise ApiError(status_code=_response.status_code, body=_response_json)
137
+
138
+ def validate(self, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
139
+ """
140
+ Validate a specific Azure export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
141
+
142
+ Parameters
143
+ ----------
144
+ request_options : typing.Optional[RequestOptions]
145
+ Request-specific configuration.
146
+
147
+ Returns
148
+ -------
149
+ AzureBlobExportStorage
150
+
151
+
152
+ Examples
153
+ --------
154
+ from label_studio_sdk.client import LabelStudio
155
+
156
+ client = LabelStudio(
157
+ api_key="YOUR_API_KEY",
158
+ )
159
+ client.export_storage.azure.validate()
160
+ """
161
+ _response = self._client_wrapper.httpx_client.request(
162
+ "api/storages/export/azure/validate", method="POST", request_options=request_options
163
+ )
164
+ if 200 <= _response.status_code < 300:
165
+ return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
166
+ try:
167
+ _response_json = _response.json()
168
+ except JSONDecodeError:
169
+ raise ApiError(status_code=_response.status_code, body=_response.text)
170
+ raise ApiError(status_code=_response.status_code, body=_response_json)
171
+
172
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
173
+ """
174
+ Get a specific Azure export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
175
+
176
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
177
+
178
+ Parameters
179
+ ----------
180
+ id : int
181
+ A unique integer value identifying this azure blob export storage.
182
+
183
+ request_options : typing.Optional[RequestOptions]
184
+ Request-specific configuration.
185
+
186
+ Returns
187
+ -------
188
+ AzureBlobExportStorage
189
+
190
+
191
+ Examples
192
+ --------
193
+ from label_studio_sdk.client import LabelStudio
194
+
195
+ client = LabelStudio(
196
+ api_key="YOUR_API_KEY",
197
+ )
198
+ client.export_storage.azure.get(
199
+ id=1,
200
+ )
201
+ """
202
+ _response = self._client_wrapper.httpx_client.request(
203
+ f"api/storages/export/azure/{jsonable_encoder(id)}", method="GET", request_options=request_options
204
+ )
205
+ if 200 <= _response.status_code < 300:
206
+ return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
207
+ try:
208
+ _response_json = _response.json()
209
+ except JSONDecodeError:
210
+ raise ApiError(status_code=_response.status_code, body=_response.text)
211
+ raise ApiError(status_code=_response.status_code, body=_response_json)
212
+
213
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
214
+ """
215
+ Delete a specific Azure export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
216
+
217
+ Deleting an export/target storage connection does not affect tasks with synced data in Label Studio. If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
218
+
219
+ Parameters
220
+ ----------
221
+ id : int
222
+ A unique integer value identifying this azure blob export storage.
223
+
224
+ request_options : typing.Optional[RequestOptions]
225
+ Request-specific configuration.
226
+
227
+ Returns
228
+ -------
229
+ None
230
+
231
+ Examples
232
+ --------
233
+ from label_studio_sdk.client import LabelStudio
234
+
235
+ client = LabelStudio(
236
+ api_key="YOUR_API_KEY",
237
+ )
238
+ client.export_storage.azure.delete(
239
+ id=1,
240
+ )
241
+ """
242
+ _response = self._client_wrapper.httpx_client.request(
243
+ f"api/storages/export/azure/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
244
+ )
245
+ if 200 <= _response.status_code < 300:
246
+ return
247
+ try:
248
+ _response_json = _response.json()
249
+ except JSONDecodeError:
250
+ raise ApiError(status_code=_response.status_code, body=_response.text)
251
+ raise ApiError(status_code=_response.status_code, body=_response_json)
252
+
253
+ def update(
254
+ self,
255
+ id: int,
256
+ *,
257
+ project: typing.Optional[int] = OMIT,
258
+ container: typing.Optional[str] = OMIT,
259
+ prefix: typing.Optional[str] = OMIT,
260
+ account_name: typing.Optional[str] = OMIT,
261
+ account_key: typing.Optional[str] = OMIT,
262
+ request_options: typing.Optional[RequestOptions] = None,
263
+ ) -> AzureUpdateResponse:
264
+ """
265
+ Update a specific Azure export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
266
+
267
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
268
+
269
+ Parameters
270
+ ----------
271
+ id : int
272
+ A unique integer value identifying this azure blob export storage.
273
+
274
+ project : typing.Optional[int]
275
+ Project ID
276
+
277
+ container : typing.Optional[str]
278
+ Azure blob container
279
+
280
+ prefix : typing.Optional[str]
281
+ Azure blob prefix name
282
+
283
+ account_name : typing.Optional[str]
284
+ Azure Blob account name
285
+
286
+ account_key : typing.Optional[str]
287
+ Azure Blob account key
288
+
289
+ request_options : typing.Optional[RequestOptions]
290
+ Request-specific configuration.
291
+
292
+ Returns
293
+ -------
294
+ AzureUpdateResponse
295
+
296
+
297
+ Examples
298
+ --------
299
+ from label_studio_sdk.client import LabelStudio
300
+
301
+ client = LabelStudio(
302
+ api_key="YOUR_API_KEY",
303
+ )
304
+ client.export_storage.azure.update(
305
+ id=1,
306
+ )
307
+ """
308
+ _response = self._client_wrapper.httpx_client.request(
309
+ f"api/storages/export/azure/{jsonable_encoder(id)}",
310
+ method="PATCH",
311
+ json={
312
+ "project": project,
313
+ "container": container,
314
+ "prefix": prefix,
315
+ "account_name": account_name,
316
+ "account_key": account_key,
317
+ },
318
+ request_options=request_options,
319
+ omit=OMIT,
320
+ )
321
+ if 200 <= _response.status_code < 300:
322
+ return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
323
+ try:
324
+ _response_json = _response.json()
325
+ except JSONDecodeError:
326
+ raise ApiError(status_code=_response.status_code, body=_response.text)
327
+ raise ApiError(status_code=_response.status_code, body=_response_json)
328
+
329
+ def sync(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
330
+ """
331
+ Sync tasks to an Azure export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
332
+
333
+ Sync operations with external containers only go one way. They either create tasks from objects in the container (source/import storage) or push annotations to the output container (export/target storage). Changing something on the Microsoft side doesn’t guarantee consistency in results.
334
+
335
+ <Note>Before proceeding, you should review [How sync operations work - Source storage](https://labelstud.io/guide/storage#Source-storage) to ensure that your data remains secure and private.</Note>
336
+
337
+ Parameters
338
+ ----------
339
+ id : str
340
+
341
+ request_options : typing.Optional[RequestOptions]
342
+ Request-specific configuration.
343
+
344
+ Returns
345
+ -------
346
+ AzureBlobExportStorage
347
+
348
+
349
+ Examples
350
+ --------
351
+ from label_studio_sdk.client import LabelStudio
352
+
353
+ client = LabelStudio(
354
+ api_key="YOUR_API_KEY",
355
+ )
356
+ client.export_storage.azure.sync(
357
+ id="id",
358
+ )
359
+ """
360
+ _response = self._client_wrapper.httpx_client.request(
361
+ f"api/storages/export/azure/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
362
+ )
363
+ if 200 <= _response.status_code < 300:
364
+ return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
365
+ try:
366
+ _response_json = _response.json()
367
+ except JSONDecodeError:
368
+ raise ApiError(status_code=_response.status_code, body=_response.text)
369
+ raise ApiError(status_code=_response.status_code, body=_response_json)
370
+
371
+
372
+ class AsyncAzureClient:
373
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
374
+ self._client_wrapper = client_wrapper
375
+
376
+ async def list(
377
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
378
+ ) -> typing.List[AzureBlobExportStorage]:
379
+ """
380
+ You can connect your Microsoft Azure Blob storage container to Label Studio as a source storage or target storage. Use this API request to get a list of all Azure export (target) storage connections for a specific project.
381
+
382
+ 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).
383
+
384
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
385
+
386
+ Parameters
387
+ ----------
388
+ project : typing.Optional[int]
389
+ Project ID
390
+
391
+ request_options : typing.Optional[RequestOptions]
392
+ Request-specific configuration.
393
+
394
+ Returns
395
+ -------
396
+ typing.List[AzureBlobExportStorage]
397
+
398
+
399
+ Examples
400
+ --------
401
+ from label_studio_sdk.client import AsyncLabelStudio
402
+
403
+ client = AsyncLabelStudio(
404
+ api_key="YOUR_API_KEY",
405
+ )
406
+ await client.export_storage.azure.list()
407
+ """
408
+ _response = await self._client_wrapper.httpx_client.request(
409
+ "api/storages/export/azure", method="GET", params={"project": project}, request_options=request_options
410
+ )
411
+ if 200 <= _response.status_code < 300:
412
+ return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
413
+ try:
414
+ _response_json = _response.json()
415
+ except JSONDecodeError:
416
+ raise ApiError(status_code=_response.status_code, body=_response.text)
417
+ raise ApiError(status_code=_response.status_code, body=_response_json)
418
+
419
+ async def create(
420
+ self,
421
+ *,
422
+ project: typing.Optional[int] = OMIT,
423
+ container: typing.Optional[str] = OMIT,
424
+ prefix: typing.Optional[str] = OMIT,
425
+ account_name: typing.Optional[str] = OMIT,
426
+ account_key: typing.Optional[str] = OMIT,
427
+ request_options: typing.Optional[RequestOptions] = None,
428
+ ) -> AzureCreateResponse:
429
+ """
430
+ Create a new target storage connection to Microsoft Azure Blob storage.
431
+
432
+ For information about the required fields and prerequisites, see [Microsoft Azure Blob storage](https://labelstud.io/guide/storage#Microsoft-Azure-Blob-storage) in the Label Studio documentation.
433
+
434
+ <Tip>After you add the storage, you should validate the connection before attempting to sync your data. Your data will not be exported until you [sync your connection](sync).</Tip>
435
+
436
+ Parameters
437
+ ----------
438
+ project : typing.Optional[int]
439
+ Project ID
440
+
441
+ container : typing.Optional[str]
442
+ Azure blob container
443
+
444
+ prefix : typing.Optional[str]
445
+ Azure blob prefix name
446
+
447
+ account_name : typing.Optional[str]
448
+ Azure Blob account name
449
+
450
+ account_key : typing.Optional[str]
451
+ Azure Blob account key
452
+
453
+ request_options : typing.Optional[RequestOptions]
454
+ Request-specific configuration.
455
+
456
+ Returns
457
+ -------
458
+ AzureCreateResponse
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.export_storage.azure.create()
469
+ """
470
+ _response = await self._client_wrapper.httpx_client.request(
471
+ "api/storages/export/azure",
472
+ method="POST",
473
+ json={
474
+ "project": project,
475
+ "container": container,
476
+ "prefix": prefix,
477
+ "account_name": account_name,
478
+ "account_key": account_key,
479
+ },
480
+ request_options=request_options,
481
+ omit=OMIT,
482
+ )
483
+ if 200 <= _response.status_code < 300:
484
+ return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
485
+ try:
486
+ _response_json = _response.json()
487
+ except JSONDecodeError:
488
+ raise ApiError(status_code=_response.status_code, body=_response.text)
489
+ raise ApiError(status_code=_response.status_code, body=_response_json)
490
+
491
+ async def validate(self, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
492
+ """
493
+ Validate a specific Azure export storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to export data.
494
+
495
+ Parameters
496
+ ----------
497
+ request_options : typing.Optional[RequestOptions]
498
+ Request-specific configuration.
499
+
500
+ Returns
501
+ -------
502
+ AzureBlobExportStorage
503
+
504
+
505
+ Examples
506
+ --------
507
+ from label_studio_sdk.client import AsyncLabelStudio
508
+
509
+ client = AsyncLabelStudio(
510
+ api_key="YOUR_API_KEY",
511
+ )
512
+ await client.export_storage.azure.validate()
513
+ """
514
+ _response = await self._client_wrapper.httpx_client.request(
515
+ "api/storages/export/azure/validate", method="POST", request_options=request_options
516
+ )
517
+ if 200 <= _response.status_code < 300:
518
+ return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
519
+ try:
520
+ _response_json = _response.json()
521
+ except JSONDecodeError:
522
+ raise ApiError(status_code=_response.status_code, body=_response.text)
523
+ raise ApiError(status_code=_response.status_code, body=_response_json)
524
+
525
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
526
+ """
527
+ Get a specific Azure export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
528
+
529
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
530
+
531
+ Parameters
532
+ ----------
533
+ id : int
534
+ A unique integer value identifying this azure blob export storage.
535
+
536
+ request_options : typing.Optional[RequestOptions]
537
+ Request-specific configuration.
538
+
539
+ Returns
540
+ -------
541
+ AzureBlobExportStorage
542
+
543
+
544
+ Examples
545
+ --------
546
+ from label_studio_sdk.client import AsyncLabelStudio
547
+
548
+ client = AsyncLabelStudio(
549
+ api_key="YOUR_API_KEY",
550
+ )
551
+ await client.export_storage.azure.get(
552
+ id=1,
553
+ )
554
+ """
555
+ _response = await self._client_wrapper.httpx_client.request(
556
+ f"api/storages/export/azure/{jsonable_encoder(id)}", method="GET", request_options=request_options
557
+ )
558
+ if 200 <= _response.status_code < 300:
559
+ return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
560
+ try:
561
+ _response_json = _response.json()
562
+ except JSONDecodeError:
563
+ raise ApiError(status_code=_response.status_code, body=_response.text)
564
+ raise ApiError(status_code=_response.status_code, body=_response_json)
565
+
566
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
567
+ """
568
+ Delete a specific Azure export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
569
+
570
+ Deleting an export/target storage connection does not affect tasks with synced data in Label Studio. If you want to remove the tasks that were synced from the external storage, you will need to delete them manually from within the Label Studio UI or use the [Delete tasks](../../tasks/delete-all-tasks) API.
571
+
572
+ Parameters
573
+ ----------
574
+ id : int
575
+ A unique integer value identifying this azure blob export storage.
576
+
577
+ request_options : typing.Optional[RequestOptions]
578
+ Request-specific configuration.
579
+
580
+ Returns
581
+ -------
582
+ None
583
+
584
+ Examples
585
+ --------
586
+ from label_studio_sdk.client import AsyncLabelStudio
587
+
588
+ client = AsyncLabelStudio(
589
+ api_key="YOUR_API_KEY",
590
+ )
591
+ await client.export_storage.azure.delete(
592
+ id=1,
593
+ )
594
+ """
595
+ _response = await self._client_wrapper.httpx_client.request(
596
+ f"api/storages/export/azure/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
597
+ )
598
+ if 200 <= _response.status_code < 300:
599
+ return
600
+ try:
601
+ _response_json = _response.json()
602
+ except JSONDecodeError:
603
+ raise ApiError(status_code=_response.status_code, body=_response.text)
604
+ raise ApiError(status_code=_response.status_code, body=_response_json)
605
+
606
+ async def update(
607
+ self,
608
+ id: int,
609
+ *,
610
+ project: typing.Optional[int] = OMIT,
611
+ container: typing.Optional[str] = OMIT,
612
+ prefix: typing.Optional[str] = OMIT,
613
+ account_name: typing.Optional[str] = OMIT,
614
+ account_key: typing.Optional[str] = OMIT,
615
+ request_options: typing.Optional[RequestOptions] = None,
616
+ ) -> AzureUpdateResponse:
617
+ """
618
+ Update a specific Azure export storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
619
+
620
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
621
+
622
+ Parameters
623
+ ----------
624
+ id : int
625
+ A unique integer value identifying this azure blob export storage.
626
+
627
+ project : typing.Optional[int]
628
+ Project ID
629
+
630
+ container : typing.Optional[str]
631
+ Azure blob container
632
+
633
+ prefix : typing.Optional[str]
634
+ Azure blob prefix name
635
+
636
+ account_name : typing.Optional[str]
637
+ Azure Blob account name
638
+
639
+ account_key : typing.Optional[str]
640
+ Azure Blob account key
641
+
642
+ request_options : typing.Optional[RequestOptions]
643
+ Request-specific configuration.
644
+
645
+ Returns
646
+ -------
647
+ AzureUpdateResponse
648
+
649
+
650
+ Examples
651
+ --------
652
+ from label_studio_sdk.client import AsyncLabelStudio
653
+
654
+ client = AsyncLabelStudio(
655
+ api_key="YOUR_API_KEY",
656
+ )
657
+ await client.export_storage.azure.update(
658
+ id=1,
659
+ )
660
+ """
661
+ _response = await self._client_wrapper.httpx_client.request(
662
+ f"api/storages/export/azure/{jsonable_encoder(id)}",
663
+ method="PATCH",
664
+ json={
665
+ "project": project,
666
+ "container": container,
667
+ "prefix": prefix,
668
+ "account_name": account_name,
669
+ "account_key": account_key,
670
+ },
671
+ request_options=request_options,
672
+ omit=OMIT,
673
+ )
674
+ if 200 <= _response.status_code < 300:
675
+ return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
676
+ try:
677
+ _response_json = _response.json()
678
+ except JSONDecodeError:
679
+ raise ApiError(status_code=_response.status_code, body=_response.text)
680
+ raise ApiError(status_code=_response.status_code, body=_response_json)
681
+
682
+ async def sync(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
683
+ """
684
+ Sync tasks to an Azure export/target storage connection. You will need to provide the export storage ID. You can find this using [List export storages](list).
685
+
686
+ Sync operations with external containers only go one way. They either create tasks from objects in the container (source/import storage) or push annotations to the output container (export/target storage). Changing something on the Microsoft side doesn’t guarantee consistency in results.
687
+
688
+ <Note>Before proceeding, you should review [How sync operations work - Source storage](https://labelstud.io/guide/storage#Source-storage) to ensure that your data remains secure and private.</Note>
689
+
690
+ Parameters
691
+ ----------
692
+ id : str
693
+
694
+ request_options : typing.Optional[RequestOptions]
695
+ Request-specific configuration.
696
+
697
+ Returns
698
+ -------
699
+ AzureBlobExportStorage
700
+
701
+
702
+ Examples
703
+ --------
704
+ from label_studio_sdk.client import AsyncLabelStudio
705
+
706
+ client = AsyncLabelStudio(
707
+ api_key="YOUR_API_KEY",
708
+ )
709
+ await client.export_storage.azure.sync(
710
+ id="id",
711
+ )
712
+ """
713
+ _response = await self._client_wrapper.httpx_client.request(
714
+ f"api/storages/export/azure/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
715
+ )
716
+ if 200 <= _response.status_code < 300:
717
+ return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
718
+ try:
719
+ _response_json = _response.json()
720
+ except JSONDecodeError:
721
+ raise ApiError(status_code=_response.status_code, body=_response.text)
722
+ raise ApiError(status_code=_response.status_code, body=_response_json)