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.
- label_studio_sdk/__init__.py +232 -9
- label_studio_sdk/_extensions/label_studio_tools/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/core/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/core/label_config.py +163 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/exceptions.py +2 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +228 -0
- label_studio_sdk/_extensions/label_studio_tools/core/utils/params.py +45 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/__init__.py +1 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/beam.py +34 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/example.py +17 -0
- label_studio_sdk/_extensions/label_studio_tools/etl/registry.py +67 -0
- label_studio_sdk/_extensions/label_studio_tools/postprocessing/__init__.py +0 -0
- label_studio_sdk/_extensions/label_studio_tools/postprocessing/video.py +97 -0
- label_studio_sdk/_extensions/pager_ext.py +49 -0
- label_studio_sdk/_legacy/__init__.py +11 -0
- label_studio_sdk/_legacy/client.py +471 -0
- label_studio_sdk/_legacy/objects.py +74 -0
- label_studio_sdk/{project.py → _legacy/project.py} +2 -2
- label_studio_sdk/{schema → _legacy/schema}/label_config_schema.json +14 -14
- label_studio_sdk/actions/__init__.py +27 -0
- label_studio_sdk/actions/client.py +223 -0
- label_studio_sdk/actions/types/__init__.py +25 -0
- label_studio_sdk/actions/types/actions_create_request_filters.py +43 -0
- label_studio_sdk/actions/types/actions_create_request_filters_conjunction.py +5 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +49 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/actions/types/actions_create_request_id.py +19 -0
- label_studio_sdk/actions/types/actions_create_request_ordering_item.py +31 -0
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +10 -0
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +39 -0
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +39 -0
- label_studio_sdk/annotations/__init__.py +2 -0
- label_studio_sdk/annotations/client.py +750 -0
- label_studio_sdk/base_client.py +183 -0
- label_studio_sdk/client.py +17 -463
- label_studio_sdk/converter/__init__.py +7 -0
- label_studio_sdk/converter/audio.py +56 -0
- label_studio_sdk/converter/brush.py +452 -0
- label_studio_sdk/converter/converter.py +1175 -0
- label_studio_sdk/converter/exports/__init__.py +0 -0
- label_studio_sdk/converter/exports/csv.py +82 -0
- label_studio_sdk/converter/exports/csv2.py +103 -0
- label_studio_sdk/converter/funsd.py +85 -0
- label_studio_sdk/converter/imports/__init__.py +0 -0
- label_studio_sdk/converter/imports/coco.py +314 -0
- label_studio_sdk/converter/imports/colors.py +198 -0
- label_studio_sdk/converter/imports/label_config.py +45 -0
- label_studio_sdk/converter/imports/pathtrack.py +269 -0
- label_studio_sdk/converter/imports/yolo.py +236 -0
- label_studio_sdk/converter/main.py +202 -0
- label_studio_sdk/converter/utils.py +473 -0
- label_studio_sdk/core/__init__.py +33 -0
- label_studio_sdk/core/api_error.py +15 -0
- label_studio_sdk/core/client_wrapper.py +55 -0
- label_studio_sdk/core/datetime_utils.py +28 -0
- label_studio_sdk/core/file.py +38 -0
- label_studio_sdk/core/http_client.py +447 -0
- label_studio_sdk/core/jsonable_encoder.py +99 -0
- label_studio_sdk/core/pagination.py +87 -0
- label_studio_sdk/core/pydantic_utilities.py +28 -0
- label_studio_sdk/core/query_encoder.py +33 -0
- label_studio_sdk/core/remove_none_from_dict.py +11 -0
- label_studio_sdk/core/request_options.py +32 -0
- label_studio_sdk/environment.py +7 -0
- label_studio_sdk/errors/__init__.py +6 -0
- label_studio_sdk/errors/bad_request_error.py +8 -0
- label_studio_sdk/errors/internal_server_error.py +8 -0
- label_studio_sdk/export_storage/__init__.py +28 -0
- label_studio_sdk/export_storage/azure/__init__.py +5 -0
- label_studio_sdk/export_storage/azure/client.py +888 -0
- label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +67 -0
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +67 -0
- label_studio_sdk/export_storage/client.py +107 -0
- label_studio_sdk/export_storage/gcs/__init__.py +5 -0
- label_studio_sdk/export_storage/gcs/client.py +888 -0
- label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +67 -0
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +67 -0
- label_studio_sdk/export_storage/local/__init__.py +5 -0
- label_studio_sdk/export_storage/local/client.py +834 -0
- label_studio_sdk/export_storage/local/types/__init__.py +6 -0
- label_studio_sdk/export_storage/local/types/local_create_response.py +57 -0
- label_studio_sdk/export_storage/local/types/local_update_response.py +57 -0
- label_studio_sdk/export_storage/redis/__init__.py +5 -0
- label_studio_sdk/export_storage/redis/client.py +918 -0
- label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +72 -0
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +72 -0
- label_studio_sdk/export_storage/s3/__init__.py +5 -0
- label_studio_sdk/export_storage/s3/client.py +1008 -0
- label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
- label_studio_sdk/export_storage/s3/types/s3create_response.py +89 -0
- label_studio_sdk/export_storage/s3/types/s3update_response.py +89 -0
- label_studio_sdk/export_storage/types/__init__.py +5 -0
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +30 -0
- label_studio_sdk/files/__init__.py +2 -0
- label_studio_sdk/files/client.py +556 -0
- label_studio_sdk/import_storage/__init__.py +28 -0
- label_studio_sdk/import_storage/azure/__init__.py +5 -0
- label_studio_sdk/import_storage/azure/client.py +988 -0
- label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +82 -0
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +82 -0
- label_studio_sdk/import_storage/client.py +107 -0
- label_studio_sdk/import_storage/gcs/__init__.py +5 -0
- label_studio_sdk/import_storage/gcs/client.py +988 -0
- label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +82 -0
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +82 -0
- label_studio_sdk/import_storage/local/__init__.py +5 -0
- label_studio_sdk/import_storage/local/client.py +836 -0
- label_studio_sdk/import_storage/local/types/__init__.py +6 -0
- label_studio_sdk/import_storage/local/types/local_create_response.py +57 -0
- label_studio_sdk/import_storage/local/types/local_update_response.py +57 -0
- label_studio_sdk/import_storage/redis/__init__.py +5 -0
- label_studio_sdk/import_storage/redis/client.py +924 -0
- label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +72 -0
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +72 -0
- label_studio_sdk/import_storage/s3/__init__.py +5 -0
- label_studio_sdk/import_storage/s3/client.py +1138 -0
- label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
- label_studio_sdk/import_storage/s3/types/s3create_response.py +109 -0
- label_studio_sdk/import_storage/s3/types/s3update_response.py +109 -0
- label_studio_sdk/import_storage/types/__init__.py +5 -0
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +30 -0
- label_studio_sdk/label_interface/base.py +10 -0
- label_studio_sdk/label_interface/control_tags.py +109 -71
- label_studio_sdk/label_interface/data_examples.json +96 -0
- label_studio_sdk/label_interface/interface.py +102 -53
- label_studio_sdk/label_interface/object_tags.py +8 -13
- label_studio_sdk/label_interface/region.py +33 -1
- label_studio_sdk/ml/__init__.py +19 -0
- label_studio_sdk/ml/client.py +981 -0
- label_studio_sdk/ml/types/__init__.py +17 -0
- label_studio_sdk/ml/types/ml_create_request_auth_method.py +5 -0
- label_studio_sdk/ml/types/ml_create_response.py +78 -0
- label_studio_sdk/ml/types/ml_create_response_auth_method.py +5 -0
- label_studio_sdk/ml/types/ml_update_request_auth_method.py +5 -0
- label_studio_sdk/ml/types/ml_update_response.py +78 -0
- label_studio_sdk/ml/types/ml_update_response_auth_method.py +5 -0
- label_studio_sdk/predictions/__init__.py +2 -0
- label_studio_sdk/predictions/client.py +638 -0
- label_studio_sdk/projects/__init__.py +6 -0
- label_studio_sdk/projects/client.py +1055 -0
- label_studio_sdk/projects/client_ext.py +19 -0
- label_studio_sdk/projects/exports/__init__.py +2 -0
- label_studio_sdk/projects/exports/client.py +930 -0
- label_studio_sdk/projects/types/__init__.py +7 -0
- label_studio_sdk/projects/types/projects_create_response.py +96 -0
- label_studio_sdk/projects/types/projects_import_tasks_response.py +71 -0
- label_studio_sdk/projects/types/projects_list_response.py +33 -0
- label_studio_sdk/py.typed +0 -0
- label_studio_sdk/tasks/__init__.py +5 -0
- label_studio_sdk/tasks/client.py +835 -0
- label_studio_sdk/tasks/client_ext.py +18 -0
- label_studio_sdk/tasks/types/__init__.py +6 -0
- label_studio_sdk/tasks/types/tasks_list_request_fields.py +5 -0
- label_studio_sdk/tasks/types/tasks_list_response.py +48 -0
- label_studio_sdk/types/__init__.py +115 -0
- label_studio_sdk/types/annotation.py +116 -0
- label_studio_sdk/types/annotation_filter_options.py +42 -0
- label_studio_sdk/types/annotation_last_action.py +19 -0
- label_studio_sdk/types/azure_blob_export_storage.py +112 -0
- label_studio_sdk/types/azure_blob_export_storage_status.py +7 -0
- label_studio_sdk/types/azure_blob_import_storage.py +113 -0
- label_studio_sdk/types/azure_blob_import_storage_status.py +7 -0
- label_studio_sdk/types/base_task.py +113 -0
- label_studio_sdk/types/base_user.py +42 -0
- label_studio_sdk/types/converted_format.py +36 -0
- label_studio_sdk/types/converted_format_status.py +5 -0
- label_studio_sdk/types/export.py +48 -0
- label_studio_sdk/types/export_convert.py +32 -0
- label_studio_sdk/types/export_create.py +54 -0
- label_studio_sdk/types/export_create_status.py +5 -0
- label_studio_sdk/types/export_status.py +5 -0
- label_studio_sdk/types/file_upload.py +30 -0
- label_studio_sdk/types/filter.py +53 -0
- label_studio_sdk/types/filter_group.py +35 -0
- label_studio_sdk/types/gcs_export_storage.py +112 -0
- label_studio_sdk/types/gcs_export_storage_status.py +7 -0
- label_studio_sdk/types/gcs_import_storage.py +113 -0
- label_studio_sdk/types/gcs_import_storage_status.py +7 -0
- label_studio_sdk/types/local_files_export_storage.py +97 -0
- label_studio_sdk/types/local_files_export_storage_status.py +7 -0
- label_studio_sdk/types/local_files_import_storage.py +92 -0
- label_studio_sdk/types/local_files_import_storage_status.py +7 -0
- label_studio_sdk/types/ml_backend.py +89 -0
- label_studio_sdk/types/ml_backend_auth_method.py +5 -0
- label_studio_sdk/types/ml_backend_state.py +5 -0
- label_studio_sdk/types/prediction.py +78 -0
- label_studio_sdk/types/project.py +198 -0
- label_studio_sdk/types/project_import.py +63 -0
- label_studio_sdk/types/project_import_status.py +5 -0
- label_studio_sdk/types/project_label_config.py +32 -0
- label_studio_sdk/types/project_sampling.py +7 -0
- label_studio_sdk/types/project_skip_queue.py +5 -0
- label_studio_sdk/types/redis_export_storage.py +117 -0
- label_studio_sdk/types/redis_export_storage_status.py +7 -0
- label_studio_sdk/types/redis_import_storage.py +112 -0
- label_studio_sdk/types/redis_import_storage_status.py +7 -0
- label_studio_sdk/types/s3export_storage.py +134 -0
- label_studio_sdk/types/s3export_storage_status.py +7 -0
- label_studio_sdk/types/s3import_storage.py +140 -0
- label_studio_sdk/types/s3import_storage_status.py +7 -0
- label_studio_sdk/types/serialization_option.py +36 -0
- label_studio_sdk/types/serialization_options.py +45 -0
- label_studio_sdk/types/task.py +157 -0
- label_studio_sdk/types/task_filter_options.py +49 -0
- label_studio_sdk/types/user_simple.py +37 -0
- label_studio_sdk/types/view.py +55 -0
- label_studio_sdk/types/webhook.py +67 -0
- label_studio_sdk/types/webhook_actions_item.py +21 -0
- label_studio_sdk/types/webhook_serializer_for_update.py +67 -0
- label_studio_sdk/types/webhook_serializer_for_update_actions_item.py +21 -0
- label_studio_sdk/users/__init__.py +5 -0
- label_studio_sdk/users/client.py +830 -0
- label_studio_sdk/users/types/__init__.py +6 -0
- label_studio_sdk/users/types/users_get_token_response.py +36 -0
- label_studio_sdk/users/types/users_reset_token_response.py +36 -0
- label_studio_sdk/version.py +4 -0
- label_studio_sdk/views/__init__.py +35 -0
- label_studio_sdk/views/client.py +564 -0
- label_studio_sdk/views/types/__init__.py +33 -0
- label_studio_sdk/views/types/views_create_request_data.py +43 -0
- label_studio_sdk/views/types/views_create_request_data_filters.py +43 -0
- label_studio_sdk/views/types/views_create_request_data_filters_conjunction.py +5 -0
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +49 -0
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_filter.py +31 -0
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_operator.py +23 -0
- label_studio_sdk/views/types/views_create_request_data_ordering_item.py +31 -0
- label_studio_sdk/views/types/views_update_request_data.py +43 -0
- label_studio_sdk/views/types/views_update_request_data_filters.py +43 -0
- label_studio_sdk/views/types/views_update_request_data_filters_conjunction.py +5 -0
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +49 -0
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_filter.py +31 -0
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_operator.py +23 -0
- label_studio_sdk/views/types/views_update_request_data_ordering_item.py +31 -0
- label_studio_sdk/webhooks/__init__.py +5 -0
- label_studio_sdk/webhooks/client.py +636 -0
- label_studio_sdk/webhooks/types/__init__.py +5 -0
- label_studio_sdk/webhooks/types/webhooks_update_request_actions_item.py +21 -0
- label_studio_sdk-1.0.1.dist-info/METADATA +163 -0
- label_studio_sdk-1.0.1.dist-info/RECORD +256 -0
- {label_studio_sdk-0.0.34.dist-info → label_studio_sdk-1.0.1.dist-info}/WHEEL +1 -2
- label_studio_sdk/objects.py +0 -35
- label_studio_sdk-0.0.34.dist-info/LICENSE +0 -201
- label_studio_sdk-0.0.34.dist-info/METADATA +0 -24
- label_studio_sdk-0.0.34.dist-info/RECORD +0 -37
- label_studio_sdk-0.0.34.dist-info/top_level.txt +0 -2
- tests/test_client.py +0 -37
- tests/test_export.py +0 -105
- tests/test_interface/__init__.py +0 -1
- tests/test_interface/configs.py +0 -137
- tests/test_interface/mockups.py +0 -22
- tests/test_interface/test_compat.py +0 -64
- tests/test_interface/test_control_tags.py +0 -55
- tests/test_interface/test_data_generation.py +0 -45
- tests/test_interface/test_lpi.py +0 -15
- tests/test_interface/test_main.py +0 -196
- tests/test_interface/test_object_tags.py +0 -36
- tests/test_interface/test_region.py +0 -36
- tests/test_interface/test_validate_summary.py +0 -35
- tests/test_interface/test_validation.py +0 -59
- {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
- /label_studio_sdk/{exceptions.py → _legacy/exceptions.py} +0 -0
- /label_studio_sdk/{users.py → _legacy/users.py} +0 -0
- /label_studio_sdk/{utils.py → _legacy/utils.py} +0 -0
- /label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +0 -0
|
@@ -0,0 +1,888 @@
|
|
|
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
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
70
|
+
title: typing.Optional[str] = OMIT,
|
|
71
|
+
description: typing.Optional[str] = OMIT,
|
|
72
|
+
project: typing.Optional[int] = OMIT,
|
|
73
|
+
container: typing.Optional[str] = OMIT,
|
|
74
|
+
prefix: typing.Optional[str] = OMIT,
|
|
75
|
+
account_name: typing.Optional[str] = OMIT,
|
|
76
|
+
account_key: typing.Optional[str] = OMIT,
|
|
77
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
78
|
+
) -> AzureCreateResponse:
|
|
79
|
+
"""
|
|
80
|
+
Create a new target storage connection to Microsoft Azure Blob storage.
|
|
81
|
+
|
|
82
|
+
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.
|
|
83
|
+
|
|
84
|
+
<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>
|
|
85
|
+
|
|
86
|
+
Parameters
|
|
87
|
+
----------
|
|
88
|
+
can_delete_objects : typing.Optional[bool]
|
|
89
|
+
Deletion from storage enabled
|
|
90
|
+
|
|
91
|
+
title : typing.Optional[str]
|
|
92
|
+
Storage title
|
|
93
|
+
|
|
94
|
+
description : typing.Optional[str]
|
|
95
|
+
Storage description
|
|
96
|
+
|
|
97
|
+
project : typing.Optional[int]
|
|
98
|
+
Project ID
|
|
99
|
+
|
|
100
|
+
container : typing.Optional[str]
|
|
101
|
+
Azure blob container
|
|
102
|
+
|
|
103
|
+
prefix : typing.Optional[str]
|
|
104
|
+
Azure blob prefix name
|
|
105
|
+
|
|
106
|
+
account_name : typing.Optional[str]
|
|
107
|
+
Azure Blob account name
|
|
108
|
+
|
|
109
|
+
account_key : typing.Optional[str]
|
|
110
|
+
Azure Blob account key
|
|
111
|
+
|
|
112
|
+
request_options : typing.Optional[RequestOptions]
|
|
113
|
+
Request-specific configuration.
|
|
114
|
+
|
|
115
|
+
Returns
|
|
116
|
+
-------
|
|
117
|
+
AzureCreateResponse
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
Examples
|
|
121
|
+
--------
|
|
122
|
+
from label_studio_sdk.client import LabelStudio
|
|
123
|
+
|
|
124
|
+
client = LabelStudio(
|
|
125
|
+
api_key="YOUR_API_KEY",
|
|
126
|
+
)
|
|
127
|
+
client.export_storage.azure.create()
|
|
128
|
+
"""
|
|
129
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
130
|
+
"api/storages/export/azure",
|
|
131
|
+
method="POST",
|
|
132
|
+
json={
|
|
133
|
+
"can_delete_objects": can_delete_objects,
|
|
134
|
+
"title": title,
|
|
135
|
+
"description": description,
|
|
136
|
+
"project": project,
|
|
137
|
+
"container": container,
|
|
138
|
+
"prefix": prefix,
|
|
139
|
+
"account_name": account_name,
|
|
140
|
+
"account_key": account_key,
|
|
141
|
+
},
|
|
142
|
+
request_options=request_options,
|
|
143
|
+
omit=OMIT,
|
|
144
|
+
)
|
|
145
|
+
if 200 <= _response.status_code < 300:
|
|
146
|
+
return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
|
|
147
|
+
try:
|
|
148
|
+
_response_json = _response.json()
|
|
149
|
+
except JSONDecodeError:
|
|
150
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
151
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
152
|
+
|
|
153
|
+
def validate(
|
|
154
|
+
self,
|
|
155
|
+
*,
|
|
156
|
+
id: typing.Optional[int] = OMIT,
|
|
157
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
158
|
+
title: typing.Optional[str] = OMIT,
|
|
159
|
+
description: typing.Optional[str] = OMIT,
|
|
160
|
+
project: typing.Optional[int] = OMIT,
|
|
161
|
+
container: typing.Optional[str] = OMIT,
|
|
162
|
+
prefix: typing.Optional[str] = OMIT,
|
|
163
|
+
account_name: typing.Optional[str] = OMIT,
|
|
164
|
+
account_key: typing.Optional[str] = OMIT,
|
|
165
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
166
|
+
) -> None:
|
|
167
|
+
"""
|
|
168
|
+
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.
|
|
169
|
+
|
|
170
|
+
Parameters
|
|
171
|
+
----------
|
|
172
|
+
id : typing.Optional[int]
|
|
173
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
174
|
+
|
|
175
|
+
can_delete_objects : typing.Optional[bool]
|
|
176
|
+
Deletion from storage enabled
|
|
177
|
+
|
|
178
|
+
title : typing.Optional[str]
|
|
179
|
+
Storage title
|
|
180
|
+
|
|
181
|
+
description : typing.Optional[str]
|
|
182
|
+
Storage description
|
|
183
|
+
|
|
184
|
+
project : typing.Optional[int]
|
|
185
|
+
Project ID
|
|
186
|
+
|
|
187
|
+
container : typing.Optional[str]
|
|
188
|
+
Azure blob container
|
|
189
|
+
|
|
190
|
+
prefix : typing.Optional[str]
|
|
191
|
+
Azure blob prefix name
|
|
192
|
+
|
|
193
|
+
account_name : typing.Optional[str]
|
|
194
|
+
Azure Blob account name
|
|
195
|
+
|
|
196
|
+
account_key : typing.Optional[str]
|
|
197
|
+
Azure Blob account key
|
|
198
|
+
|
|
199
|
+
request_options : typing.Optional[RequestOptions]
|
|
200
|
+
Request-specific configuration.
|
|
201
|
+
|
|
202
|
+
Returns
|
|
203
|
+
-------
|
|
204
|
+
None
|
|
205
|
+
|
|
206
|
+
Examples
|
|
207
|
+
--------
|
|
208
|
+
from label_studio_sdk.client import LabelStudio
|
|
209
|
+
|
|
210
|
+
client = LabelStudio(
|
|
211
|
+
api_key="YOUR_API_KEY",
|
|
212
|
+
)
|
|
213
|
+
client.export_storage.azure.validate()
|
|
214
|
+
"""
|
|
215
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
216
|
+
"api/storages/export/azure/validate",
|
|
217
|
+
method="POST",
|
|
218
|
+
json={
|
|
219
|
+
"id": id,
|
|
220
|
+
"can_delete_objects": can_delete_objects,
|
|
221
|
+
"title": title,
|
|
222
|
+
"description": description,
|
|
223
|
+
"project": project,
|
|
224
|
+
"container": container,
|
|
225
|
+
"prefix": prefix,
|
|
226
|
+
"account_name": account_name,
|
|
227
|
+
"account_key": account_key,
|
|
228
|
+
},
|
|
229
|
+
request_options=request_options,
|
|
230
|
+
omit=OMIT,
|
|
231
|
+
)
|
|
232
|
+
if 200 <= _response.status_code < 300:
|
|
233
|
+
return
|
|
234
|
+
try:
|
|
235
|
+
_response_json = _response.json()
|
|
236
|
+
except JSONDecodeError:
|
|
237
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
238
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
239
|
+
|
|
240
|
+
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
|
|
241
|
+
"""
|
|
242
|
+
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).
|
|
243
|
+
|
|
244
|
+
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
245
|
+
|
|
246
|
+
Parameters
|
|
247
|
+
----------
|
|
248
|
+
id : int
|
|
249
|
+
A unique integer value identifying this azure blob export storage.
|
|
250
|
+
|
|
251
|
+
request_options : typing.Optional[RequestOptions]
|
|
252
|
+
Request-specific configuration.
|
|
253
|
+
|
|
254
|
+
Returns
|
|
255
|
+
-------
|
|
256
|
+
AzureBlobExportStorage
|
|
257
|
+
|
|
258
|
+
|
|
259
|
+
Examples
|
|
260
|
+
--------
|
|
261
|
+
from label_studio_sdk.client import LabelStudio
|
|
262
|
+
|
|
263
|
+
client = LabelStudio(
|
|
264
|
+
api_key="YOUR_API_KEY",
|
|
265
|
+
)
|
|
266
|
+
client.export_storage.azure.get(
|
|
267
|
+
id=1,
|
|
268
|
+
)
|
|
269
|
+
"""
|
|
270
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
271
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
272
|
+
)
|
|
273
|
+
if 200 <= _response.status_code < 300:
|
|
274
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
275
|
+
try:
|
|
276
|
+
_response_json = _response.json()
|
|
277
|
+
except JSONDecodeError:
|
|
278
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
279
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
280
|
+
|
|
281
|
+
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
282
|
+
"""
|
|
283
|
+
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).
|
|
284
|
+
|
|
285
|
+
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.
|
|
286
|
+
|
|
287
|
+
Parameters
|
|
288
|
+
----------
|
|
289
|
+
id : int
|
|
290
|
+
A unique integer value identifying this azure blob export storage.
|
|
291
|
+
|
|
292
|
+
request_options : typing.Optional[RequestOptions]
|
|
293
|
+
Request-specific configuration.
|
|
294
|
+
|
|
295
|
+
Returns
|
|
296
|
+
-------
|
|
297
|
+
None
|
|
298
|
+
|
|
299
|
+
Examples
|
|
300
|
+
--------
|
|
301
|
+
from label_studio_sdk.client import LabelStudio
|
|
302
|
+
|
|
303
|
+
client = LabelStudio(
|
|
304
|
+
api_key="YOUR_API_KEY",
|
|
305
|
+
)
|
|
306
|
+
client.export_storage.azure.delete(
|
|
307
|
+
id=1,
|
|
308
|
+
)
|
|
309
|
+
"""
|
|
310
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
311
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
312
|
+
)
|
|
313
|
+
if 200 <= _response.status_code < 300:
|
|
314
|
+
return
|
|
315
|
+
try:
|
|
316
|
+
_response_json = _response.json()
|
|
317
|
+
except JSONDecodeError:
|
|
318
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
319
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
320
|
+
|
|
321
|
+
def update(
|
|
322
|
+
self,
|
|
323
|
+
id: int,
|
|
324
|
+
*,
|
|
325
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
326
|
+
title: typing.Optional[str] = OMIT,
|
|
327
|
+
description: typing.Optional[str] = OMIT,
|
|
328
|
+
project: typing.Optional[int] = OMIT,
|
|
329
|
+
container: typing.Optional[str] = OMIT,
|
|
330
|
+
prefix: typing.Optional[str] = OMIT,
|
|
331
|
+
account_name: typing.Optional[str] = OMIT,
|
|
332
|
+
account_key: typing.Optional[str] = OMIT,
|
|
333
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
334
|
+
) -> AzureUpdateResponse:
|
|
335
|
+
"""
|
|
336
|
+
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).
|
|
337
|
+
|
|
338
|
+
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
339
|
+
|
|
340
|
+
Parameters
|
|
341
|
+
----------
|
|
342
|
+
id : int
|
|
343
|
+
A unique integer value identifying this azure blob export storage.
|
|
344
|
+
|
|
345
|
+
can_delete_objects : typing.Optional[bool]
|
|
346
|
+
Deletion from storage enabled
|
|
347
|
+
|
|
348
|
+
title : typing.Optional[str]
|
|
349
|
+
Storage title
|
|
350
|
+
|
|
351
|
+
description : typing.Optional[str]
|
|
352
|
+
Storage description
|
|
353
|
+
|
|
354
|
+
project : typing.Optional[int]
|
|
355
|
+
Project ID
|
|
356
|
+
|
|
357
|
+
container : typing.Optional[str]
|
|
358
|
+
Azure blob container
|
|
359
|
+
|
|
360
|
+
prefix : typing.Optional[str]
|
|
361
|
+
Azure blob prefix name
|
|
362
|
+
|
|
363
|
+
account_name : typing.Optional[str]
|
|
364
|
+
Azure Blob account name
|
|
365
|
+
|
|
366
|
+
account_key : typing.Optional[str]
|
|
367
|
+
Azure Blob account key
|
|
368
|
+
|
|
369
|
+
request_options : typing.Optional[RequestOptions]
|
|
370
|
+
Request-specific configuration.
|
|
371
|
+
|
|
372
|
+
Returns
|
|
373
|
+
-------
|
|
374
|
+
AzureUpdateResponse
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
Examples
|
|
378
|
+
--------
|
|
379
|
+
from label_studio_sdk.client import LabelStudio
|
|
380
|
+
|
|
381
|
+
client = LabelStudio(
|
|
382
|
+
api_key="YOUR_API_KEY",
|
|
383
|
+
)
|
|
384
|
+
client.export_storage.azure.update(
|
|
385
|
+
id=1,
|
|
386
|
+
)
|
|
387
|
+
"""
|
|
388
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
389
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}",
|
|
390
|
+
method="PATCH",
|
|
391
|
+
json={
|
|
392
|
+
"can_delete_objects": can_delete_objects,
|
|
393
|
+
"title": title,
|
|
394
|
+
"description": description,
|
|
395
|
+
"project": project,
|
|
396
|
+
"container": container,
|
|
397
|
+
"prefix": prefix,
|
|
398
|
+
"account_name": account_name,
|
|
399
|
+
"account_key": account_key,
|
|
400
|
+
},
|
|
401
|
+
request_options=request_options,
|
|
402
|
+
omit=OMIT,
|
|
403
|
+
)
|
|
404
|
+
if 200 <= _response.status_code < 300:
|
|
405
|
+
return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
|
|
406
|
+
try:
|
|
407
|
+
_response_json = _response.json()
|
|
408
|
+
except JSONDecodeError:
|
|
409
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
410
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
411
|
+
|
|
412
|
+
def sync(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
|
|
413
|
+
"""
|
|
414
|
+
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).
|
|
415
|
+
|
|
416
|
+
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.
|
|
417
|
+
|
|
418
|
+
<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>
|
|
419
|
+
|
|
420
|
+
Parameters
|
|
421
|
+
----------
|
|
422
|
+
id : str
|
|
423
|
+
|
|
424
|
+
request_options : typing.Optional[RequestOptions]
|
|
425
|
+
Request-specific configuration.
|
|
426
|
+
|
|
427
|
+
Returns
|
|
428
|
+
-------
|
|
429
|
+
AzureBlobExportStorage
|
|
430
|
+
|
|
431
|
+
|
|
432
|
+
Examples
|
|
433
|
+
--------
|
|
434
|
+
from label_studio_sdk.client import LabelStudio
|
|
435
|
+
|
|
436
|
+
client = LabelStudio(
|
|
437
|
+
api_key="YOUR_API_KEY",
|
|
438
|
+
)
|
|
439
|
+
client.export_storage.azure.sync(
|
|
440
|
+
id="id",
|
|
441
|
+
)
|
|
442
|
+
"""
|
|
443
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
444
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
|
|
445
|
+
)
|
|
446
|
+
if 200 <= _response.status_code < 300:
|
|
447
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
448
|
+
try:
|
|
449
|
+
_response_json = _response.json()
|
|
450
|
+
except JSONDecodeError:
|
|
451
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
452
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
class AsyncAzureClient:
|
|
456
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
457
|
+
self._client_wrapper = client_wrapper
|
|
458
|
+
|
|
459
|
+
async def list(
|
|
460
|
+
self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
|
|
461
|
+
) -> typing.List[AzureBlobExportStorage]:
|
|
462
|
+
"""
|
|
463
|
+
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.
|
|
464
|
+
|
|
465
|
+
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).
|
|
466
|
+
|
|
467
|
+
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
468
|
+
|
|
469
|
+
Parameters
|
|
470
|
+
----------
|
|
471
|
+
project : typing.Optional[int]
|
|
472
|
+
Project ID
|
|
473
|
+
|
|
474
|
+
request_options : typing.Optional[RequestOptions]
|
|
475
|
+
Request-specific configuration.
|
|
476
|
+
|
|
477
|
+
Returns
|
|
478
|
+
-------
|
|
479
|
+
typing.List[AzureBlobExportStorage]
|
|
480
|
+
|
|
481
|
+
|
|
482
|
+
Examples
|
|
483
|
+
--------
|
|
484
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
485
|
+
|
|
486
|
+
client = AsyncLabelStudio(
|
|
487
|
+
api_key="YOUR_API_KEY",
|
|
488
|
+
)
|
|
489
|
+
await client.export_storage.azure.list()
|
|
490
|
+
"""
|
|
491
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
492
|
+
"api/storages/export/azure", method="GET", params={"project": project}, request_options=request_options
|
|
493
|
+
)
|
|
494
|
+
if 200 <= _response.status_code < 300:
|
|
495
|
+
return pydantic_v1.parse_obj_as(typing.List[AzureBlobExportStorage], _response.json()) # type: ignore
|
|
496
|
+
try:
|
|
497
|
+
_response_json = _response.json()
|
|
498
|
+
except JSONDecodeError:
|
|
499
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
500
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
501
|
+
|
|
502
|
+
async def create(
|
|
503
|
+
self,
|
|
504
|
+
*,
|
|
505
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
506
|
+
title: typing.Optional[str] = OMIT,
|
|
507
|
+
description: typing.Optional[str] = OMIT,
|
|
508
|
+
project: typing.Optional[int] = OMIT,
|
|
509
|
+
container: typing.Optional[str] = OMIT,
|
|
510
|
+
prefix: typing.Optional[str] = OMIT,
|
|
511
|
+
account_name: typing.Optional[str] = OMIT,
|
|
512
|
+
account_key: typing.Optional[str] = OMIT,
|
|
513
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
514
|
+
) -> AzureCreateResponse:
|
|
515
|
+
"""
|
|
516
|
+
Create a new target storage connection to Microsoft Azure Blob storage.
|
|
517
|
+
|
|
518
|
+
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.
|
|
519
|
+
|
|
520
|
+
<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>
|
|
521
|
+
|
|
522
|
+
Parameters
|
|
523
|
+
----------
|
|
524
|
+
can_delete_objects : typing.Optional[bool]
|
|
525
|
+
Deletion from storage enabled
|
|
526
|
+
|
|
527
|
+
title : typing.Optional[str]
|
|
528
|
+
Storage title
|
|
529
|
+
|
|
530
|
+
description : typing.Optional[str]
|
|
531
|
+
Storage description
|
|
532
|
+
|
|
533
|
+
project : typing.Optional[int]
|
|
534
|
+
Project ID
|
|
535
|
+
|
|
536
|
+
container : typing.Optional[str]
|
|
537
|
+
Azure blob container
|
|
538
|
+
|
|
539
|
+
prefix : typing.Optional[str]
|
|
540
|
+
Azure blob prefix name
|
|
541
|
+
|
|
542
|
+
account_name : typing.Optional[str]
|
|
543
|
+
Azure Blob account name
|
|
544
|
+
|
|
545
|
+
account_key : typing.Optional[str]
|
|
546
|
+
Azure Blob account key
|
|
547
|
+
|
|
548
|
+
request_options : typing.Optional[RequestOptions]
|
|
549
|
+
Request-specific configuration.
|
|
550
|
+
|
|
551
|
+
Returns
|
|
552
|
+
-------
|
|
553
|
+
AzureCreateResponse
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
Examples
|
|
557
|
+
--------
|
|
558
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
559
|
+
|
|
560
|
+
client = AsyncLabelStudio(
|
|
561
|
+
api_key="YOUR_API_KEY",
|
|
562
|
+
)
|
|
563
|
+
await client.export_storage.azure.create()
|
|
564
|
+
"""
|
|
565
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
566
|
+
"api/storages/export/azure",
|
|
567
|
+
method="POST",
|
|
568
|
+
json={
|
|
569
|
+
"can_delete_objects": can_delete_objects,
|
|
570
|
+
"title": title,
|
|
571
|
+
"description": description,
|
|
572
|
+
"project": project,
|
|
573
|
+
"container": container,
|
|
574
|
+
"prefix": prefix,
|
|
575
|
+
"account_name": account_name,
|
|
576
|
+
"account_key": account_key,
|
|
577
|
+
},
|
|
578
|
+
request_options=request_options,
|
|
579
|
+
omit=OMIT,
|
|
580
|
+
)
|
|
581
|
+
if 200 <= _response.status_code < 300:
|
|
582
|
+
return pydantic_v1.parse_obj_as(AzureCreateResponse, _response.json()) # type: ignore
|
|
583
|
+
try:
|
|
584
|
+
_response_json = _response.json()
|
|
585
|
+
except JSONDecodeError:
|
|
586
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
587
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
588
|
+
|
|
589
|
+
async def validate(
|
|
590
|
+
self,
|
|
591
|
+
*,
|
|
592
|
+
id: typing.Optional[int] = OMIT,
|
|
593
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
594
|
+
title: typing.Optional[str] = OMIT,
|
|
595
|
+
description: typing.Optional[str] = OMIT,
|
|
596
|
+
project: typing.Optional[int] = OMIT,
|
|
597
|
+
container: typing.Optional[str] = OMIT,
|
|
598
|
+
prefix: typing.Optional[str] = OMIT,
|
|
599
|
+
account_name: typing.Optional[str] = OMIT,
|
|
600
|
+
account_key: typing.Optional[str] = OMIT,
|
|
601
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
602
|
+
) -> None:
|
|
603
|
+
"""
|
|
604
|
+
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.
|
|
605
|
+
|
|
606
|
+
Parameters
|
|
607
|
+
----------
|
|
608
|
+
id : typing.Optional[int]
|
|
609
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
610
|
+
|
|
611
|
+
can_delete_objects : typing.Optional[bool]
|
|
612
|
+
Deletion from storage enabled
|
|
613
|
+
|
|
614
|
+
title : typing.Optional[str]
|
|
615
|
+
Storage title
|
|
616
|
+
|
|
617
|
+
description : typing.Optional[str]
|
|
618
|
+
Storage description
|
|
619
|
+
|
|
620
|
+
project : typing.Optional[int]
|
|
621
|
+
Project ID
|
|
622
|
+
|
|
623
|
+
container : typing.Optional[str]
|
|
624
|
+
Azure blob container
|
|
625
|
+
|
|
626
|
+
prefix : typing.Optional[str]
|
|
627
|
+
Azure blob prefix name
|
|
628
|
+
|
|
629
|
+
account_name : typing.Optional[str]
|
|
630
|
+
Azure Blob account name
|
|
631
|
+
|
|
632
|
+
account_key : typing.Optional[str]
|
|
633
|
+
Azure Blob account key
|
|
634
|
+
|
|
635
|
+
request_options : typing.Optional[RequestOptions]
|
|
636
|
+
Request-specific configuration.
|
|
637
|
+
|
|
638
|
+
Returns
|
|
639
|
+
-------
|
|
640
|
+
None
|
|
641
|
+
|
|
642
|
+
Examples
|
|
643
|
+
--------
|
|
644
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
645
|
+
|
|
646
|
+
client = AsyncLabelStudio(
|
|
647
|
+
api_key="YOUR_API_KEY",
|
|
648
|
+
)
|
|
649
|
+
await client.export_storage.azure.validate()
|
|
650
|
+
"""
|
|
651
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
652
|
+
"api/storages/export/azure/validate",
|
|
653
|
+
method="POST",
|
|
654
|
+
json={
|
|
655
|
+
"id": id,
|
|
656
|
+
"can_delete_objects": can_delete_objects,
|
|
657
|
+
"title": title,
|
|
658
|
+
"description": description,
|
|
659
|
+
"project": project,
|
|
660
|
+
"container": container,
|
|
661
|
+
"prefix": prefix,
|
|
662
|
+
"account_name": account_name,
|
|
663
|
+
"account_key": account_key,
|
|
664
|
+
},
|
|
665
|
+
request_options=request_options,
|
|
666
|
+
omit=OMIT,
|
|
667
|
+
)
|
|
668
|
+
if 200 <= _response.status_code < 300:
|
|
669
|
+
return
|
|
670
|
+
try:
|
|
671
|
+
_response_json = _response.json()
|
|
672
|
+
except JSONDecodeError:
|
|
673
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
674
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
675
|
+
|
|
676
|
+
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
|
|
677
|
+
"""
|
|
678
|
+
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).
|
|
679
|
+
|
|
680
|
+
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
681
|
+
|
|
682
|
+
Parameters
|
|
683
|
+
----------
|
|
684
|
+
id : int
|
|
685
|
+
A unique integer value identifying this azure blob export storage.
|
|
686
|
+
|
|
687
|
+
request_options : typing.Optional[RequestOptions]
|
|
688
|
+
Request-specific configuration.
|
|
689
|
+
|
|
690
|
+
Returns
|
|
691
|
+
-------
|
|
692
|
+
AzureBlobExportStorage
|
|
693
|
+
|
|
694
|
+
|
|
695
|
+
Examples
|
|
696
|
+
--------
|
|
697
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
698
|
+
|
|
699
|
+
client = AsyncLabelStudio(
|
|
700
|
+
api_key="YOUR_API_KEY",
|
|
701
|
+
)
|
|
702
|
+
await client.export_storage.azure.get(
|
|
703
|
+
id=1,
|
|
704
|
+
)
|
|
705
|
+
"""
|
|
706
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
707
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
708
|
+
)
|
|
709
|
+
if 200 <= _response.status_code < 300:
|
|
710
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
711
|
+
try:
|
|
712
|
+
_response_json = _response.json()
|
|
713
|
+
except JSONDecodeError:
|
|
714
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
715
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
716
|
+
|
|
717
|
+
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
718
|
+
"""
|
|
719
|
+
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).
|
|
720
|
+
|
|
721
|
+
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.
|
|
722
|
+
|
|
723
|
+
Parameters
|
|
724
|
+
----------
|
|
725
|
+
id : int
|
|
726
|
+
A unique integer value identifying this azure blob export storage.
|
|
727
|
+
|
|
728
|
+
request_options : typing.Optional[RequestOptions]
|
|
729
|
+
Request-specific configuration.
|
|
730
|
+
|
|
731
|
+
Returns
|
|
732
|
+
-------
|
|
733
|
+
None
|
|
734
|
+
|
|
735
|
+
Examples
|
|
736
|
+
--------
|
|
737
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
738
|
+
|
|
739
|
+
client = AsyncLabelStudio(
|
|
740
|
+
api_key="YOUR_API_KEY",
|
|
741
|
+
)
|
|
742
|
+
await client.export_storage.azure.delete(
|
|
743
|
+
id=1,
|
|
744
|
+
)
|
|
745
|
+
"""
|
|
746
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
747
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
748
|
+
)
|
|
749
|
+
if 200 <= _response.status_code < 300:
|
|
750
|
+
return
|
|
751
|
+
try:
|
|
752
|
+
_response_json = _response.json()
|
|
753
|
+
except JSONDecodeError:
|
|
754
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
755
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
756
|
+
|
|
757
|
+
async def update(
|
|
758
|
+
self,
|
|
759
|
+
id: int,
|
|
760
|
+
*,
|
|
761
|
+
can_delete_objects: typing.Optional[bool] = OMIT,
|
|
762
|
+
title: typing.Optional[str] = OMIT,
|
|
763
|
+
description: typing.Optional[str] = OMIT,
|
|
764
|
+
project: typing.Optional[int] = OMIT,
|
|
765
|
+
container: typing.Optional[str] = OMIT,
|
|
766
|
+
prefix: typing.Optional[str] = OMIT,
|
|
767
|
+
account_name: typing.Optional[str] = OMIT,
|
|
768
|
+
account_key: typing.Optional[str] = OMIT,
|
|
769
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
770
|
+
) -> AzureUpdateResponse:
|
|
771
|
+
"""
|
|
772
|
+
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).
|
|
773
|
+
|
|
774
|
+
For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
|
|
775
|
+
|
|
776
|
+
Parameters
|
|
777
|
+
----------
|
|
778
|
+
id : int
|
|
779
|
+
A unique integer value identifying this azure blob export storage.
|
|
780
|
+
|
|
781
|
+
can_delete_objects : typing.Optional[bool]
|
|
782
|
+
Deletion from storage enabled
|
|
783
|
+
|
|
784
|
+
title : typing.Optional[str]
|
|
785
|
+
Storage title
|
|
786
|
+
|
|
787
|
+
description : typing.Optional[str]
|
|
788
|
+
Storage description
|
|
789
|
+
|
|
790
|
+
project : typing.Optional[int]
|
|
791
|
+
Project ID
|
|
792
|
+
|
|
793
|
+
container : typing.Optional[str]
|
|
794
|
+
Azure blob container
|
|
795
|
+
|
|
796
|
+
prefix : typing.Optional[str]
|
|
797
|
+
Azure blob prefix name
|
|
798
|
+
|
|
799
|
+
account_name : typing.Optional[str]
|
|
800
|
+
Azure Blob account name
|
|
801
|
+
|
|
802
|
+
account_key : typing.Optional[str]
|
|
803
|
+
Azure Blob account key
|
|
804
|
+
|
|
805
|
+
request_options : typing.Optional[RequestOptions]
|
|
806
|
+
Request-specific configuration.
|
|
807
|
+
|
|
808
|
+
Returns
|
|
809
|
+
-------
|
|
810
|
+
AzureUpdateResponse
|
|
811
|
+
|
|
812
|
+
|
|
813
|
+
Examples
|
|
814
|
+
--------
|
|
815
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
816
|
+
|
|
817
|
+
client = AsyncLabelStudio(
|
|
818
|
+
api_key="YOUR_API_KEY",
|
|
819
|
+
)
|
|
820
|
+
await client.export_storage.azure.update(
|
|
821
|
+
id=1,
|
|
822
|
+
)
|
|
823
|
+
"""
|
|
824
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
825
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}",
|
|
826
|
+
method="PATCH",
|
|
827
|
+
json={
|
|
828
|
+
"can_delete_objects": can_delete_objects,
|
|
829
|
+
"title": title,
|
|
830
|
+
"description": description,
|
|
831
|
+
"project": project,
|
|
832
|
+
"container": container,
|
|
833
|
+
"prefix": prefix,
|
|
834
|
+
"account_name": account_name,
|
|
835
|
+
"account_key": account_key,
|
|
836
|
+
},
|
|
837
|
+
request_options=request_options,
|
|
838
|
+
omit=OMIT,
|
|
839
|
+
)
|
|
840
|
+
if 200 <= _response.status_code < 300:
|
|
841
|
+
return pydantic_v1.parse_obj_as(AzureUpdateResponse, _response.json()) # type: ignore
|
|
842
|
+
try:
|
|
843
|
+
_response_json = _response.json()
|
|
844
|
+
except JSONDecodeError:
|
|
845
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
846
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
847
|
+
|
|
848
|
+
async def sync(self, id: str, *, request_options: typing.Optional[RequestOptions] = None) -> AzureBlobExportStorage:
|
|
849
|
+
"""
|
|
850
|
+
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).
|
|
851
|
+
|
|
852
|
+
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.
|
|
853
|
+
|
|
854
|
+
<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>
|
|
855
|
+
|
|
856
|
+
Parameters
|
|
857
|
+
----------
|
|
858
|
+
id : str
|
|
859
|
+
|
|
860
|
+
request_options : typing.Optional[RequestOptions]
|
|
861
|
+
Request-specific configuration.
|
|
862
|
+
|
|
863
|
+
Returns
|
|
864
|
+
-------
|
|
865
|
+
AzureBlobExportStorage
|
|
866
|
+
|
|
867
|
+
|
|
868
|
+
Examples
|
|
869
|
+
--------
|
|
870
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
871
|
+
|
|
872
|
+
client = AsyncLabelStudio(
|
|
873
|
+
api_key="YOUR_API_KEY",
|
|
874
|
+
)
|
|
875
|
+
await client.export_storage.azure.sync(
|
|
876
|
+
id="id",
|
|
877
|
+
)
|
|
878
|
+
"""
|
|
879
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
880
|
+
f"api/storages/export/azure/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
|
|
881
|
+
)
|
|
882
|
+
if 200 <= _response.status_code < 300:
|
|
883
|
+
return pydantic_v1.parse_obj_as(AzureBlobExportStorage, _response.json()) # type: ignore
|
|
884
|
+
try:
|
|
885
|
+
_response_json = _response.json()
|
|
886
|
+
except JSONDecodeError:
|
|
887
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
888
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|