label-studio-sdk 0.0.32__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.
- label_studio_sdk/__init__.py +206 -6
- 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/_legacy/__init__.py +11 -0
- label_studio_sdk/_legacy/client.py +471 -0
- label_studio_sdk/_legacy/exceptions.py +10 -0
- label_studio_sdk/_legacy/label_interface/__init__.py +1 -0
- label_studio_sdk/_legacy/label_interface/base.py +77 -0
- label_studio_sdk/_legacy/label_interface/control_tags.py +756 -0
- label_studio_sdk/_legacy/label_interface/data_examples.json +96 -0
- label_studio_sdk/_legacy/label_interface/interface.py +925 -0
- label_studio_sdk/_legacy/label_interface/label_tags.py +72 -0
- label_studio_sdk/_legacy/label_interface/object_tags.py +292 -0
- label_studio_sdk/_legacy/label_interface/region.py +43 -0
- label_studio_sdk/_legacy/objects.py +35 -0
- label_studio_sdk/{project.py → _legacy/project.py} +711 -258
- label_studio_sdk/_legacy/schema/label_config_schema.json +226 -0
- label_studio_sdk/{users.py → _legacy/users.py} +15 -13
- label_studio_sdk/{utils.py → _legacy/utils.py} +31 -30
- label_studio_sdk/{workspaces.py → _legacy/workspaces.py} +13 -11
- label_studio_sdk/actions/__init__.py +2 -0
- label_studio_sdk/actions/client.py +150 -0
- label_studio_sdk/annotations/__init__.py +2 -0
- label_studio_sdk/annotations/client.py +750 -0
- label_studio_sdk/client.py +164 -436
- 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 +443 -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/data_manager.py +32 -23
- 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 +722 -0
- label_studio_sdk/export_storage/azure/types/__init__.py +6 -0
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +52 -0
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +52 -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 +722 -0
- label_studio_sdk/export_storage/gcs/types/__init__.py +6 -0
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +52 -0
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +52 -0
- label_studio_sdk/export_storage/local/__init__.py +5 -0
- label_studio_sdk/export_storage/local/client.py +688 -0
- label_studio_sdk/export_storage/local/types/__init__.py +6 -0
- label_studio_sdk/export_storage/local/types/local_create_response.py +47 -0
- label_studio_sdk/export_storage/local/types/local_update_response.py +47 -0
- label_studio_sdk/export_storage/redis/__init__.py +5 -0
- label_studio_sdk/export_storage/redis/client.py +714 -0
- label_studio_sdk/export_storage/redis/types/__init__.py +6 -0
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +57 -0
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +57 -0
- label_studio_sdk/export_storage/s3/__init__.py +5 -0
- label_studio_sdk/export_storage/s3/client.py +820 -0
- label_studio_sdk/export_storage/s3/types/__init__.py +6 -0
- label_studio_sdk/export_storage/s3/types/s3create_response.py +74 -0
- label_studio_sdk/export_storage/s3/types/s3update_response.py +74 -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 +812 -0
- label_studio_sdk/import_storage/azure/types/__init__.py +6 -0
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +72 -0
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +72 -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 +812 -0
- label_studio_sdk/import_storage/gcs/types/__init__.py +6 -0
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +72 -0
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +72 -0
- label_studio_sdk/import_storage/local/__init__.py +5 -0
- label_studio_sdk/import_storage/local/client.py +690 -0
- label_studio_sdk/import_storage/local/types/__init__.py +6 -0
- label_studio_sdk/import_storage/local/types/local_create_response.py +47 -0
- label_studio_sdk/import_storage/local/types/local_update_response.py +47 -0
- label_studio_sdk/import_storage/redis/__init__.py +5 -0
- label_studio_sdk/import_storage/redis/client.py +768 -0
- label_studio_sdk/import_storage/redis/types/__init__.py +6 -0
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +62 -0
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +62 -0
- label_studio_sdk/import_storage/s3/__init__.py +5 -0
- label_studio_sdk/import_storage/s3/client.py +912 -0
- label_studio_sdk/import_storage/s3/types/__init__.py +6 -0
- label_studio_sdk/import_storage/s3/types/s3create_response.py +99 -0
- label_studio_sdk/import_storage/s3/types/s3update_response.py +99 -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/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 +1053 -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 +811 -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 +31 -0
- label_studio_sdk/views/client.py +564 -0
- label_studio_sdk/views/types/__init__.py +29 -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 +47 -0
- label_studio_sdk/views/types/views_create_request_data_ordering_item.py +38 -0
- label_studio_sdk/views/types/views_create_request_data_ordering_item_direction.py +5 -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 +47 -0
- label_studio_sdk/views/types/views_update_request_data_ordering_item.py +38 -0
- label_studio_sdk/views/types/views_update_request_data_ordering_item_direction.py +5 -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.0.dist-info/METADATA +307 -0
- label_studio_sdk-1.0.0.dist-info/RECORD +239 -0
- {label_studio_sdk-0.0.32.dist-info → label_studio_sdk-1.0.0.dist-info}/WHEEL +1 -2
- docs/__init__.py +0 -3
- label_studio_sdk-0.0.32.dist-info/LICENSE +0 -201
- label_studio_sdk-0.0.32.dist-info/METADATA +0 -22
- label_studio_sdk-0.0.32.dist-info/RECORD +0 -15
- label_studio_sdk-0.0.32.dist-info/top_level.txt +0 -3
- tests/test_client.py +0 -26
- {tests → label_studio_sdk/_extensions}/__init__.py +0 -0
|
@@ -0,0 +1,556 @@
|
|
|
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.file_upload import FileUpload
|
|
12
|
+
|
|
13
|
+
# this is used as the default value for optional parameters
|
|
14
|
+
OMIT = typing.cast(typing.Any, ...)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class FilesClient:
|
|
18
|
+
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
|
19
|
+
self._client_wrapper = client_wrapper
|
|
20
|
+
|
|
21
|
+
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> FileUpload:
|
|
22
|
+
"""
|
|
23
|
+
Retrieve details about a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
id : int
|
|
28
|
+
A unique integer value identifying this file upload.
|
|
29
|
+
|
|
30
|
+
request_options : typing.Optional[RequestOptions]
|
|
31
|
+
Request-specific configuration.
|
|
32
|
+
|
|
33
|
+
Returns
|
|
34
|
+
-------
|
|
35
|
+
FileUpload
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
Examples
|
|
39
|
+
--------
|
|
40
|
+
from label_studio_sdk.client import LabelStudio
|
|
41
|
+
|
|
42
|
+
client = LabelStudio(
|
|
43
|
+
api_key="YOUR_API_KEY",
|
|
44
|
+
)
|
|
45
|
+
client.files.get(
|
|
46
|
+
id=1,
|
|
47
|
+
)
|
|
48
|
+
"""
|
|
49
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
50
|
+
f"api/import/file-upload/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
51
|
+
)
|
|
52
|
+
if 200 <= _response.status_code < 300:
|
|
53
|
+
return pydantic_v1.parse_obj_as(FileUpload, _response.json()) # type: ignore
|
|
54
|
+
try:
|
|
55
|
+
_response_json = _response.json()
|
|
56
|
+
except JSONDecodeError:
|
|
57
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
58
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
59
|
+
|
|
60
|
+
def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
61
|
+
"""
|
|
62
|
+
Delete a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
63
|
+
|
|
64
|
+
Parameters
|
|
65
|
+
----------
|
|
66
|
+
id : int
|
|
67
|
+
A unique integer value identifying this file upload.
|
|
68
|
+
|
|
69
|
+
request_options : typing.Optional[RequestOptions]
|
|
70
|
+
Request-specific configuration.
|
|
71
|
+
|
|
72
|
+
Returns
|
|
73
|
+
-------
|
|
74
|
+
None
|
|
75
|
+
|
|
76
|
+
Examples
|
|
77
|
+
--------
|
|
78
|
+
from label_studio_sdk.client import LabelStudio
|
|
79
|
+
|
|
80
|
+
client = LabelStudio(
|
|
81
|
+
api_key="YOUR_API_KEY",
|
|
82
|
+
)
|
|
83
|
+
client.files.delete(
|
|
84
|
+
id=1,
|
|
85
|
+
)
|
|
86
|
+
"""
|
|
87
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
88
|
+
f"api/import/file-upload/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
89
|
+
)
|
|
90
|
+
if 200 <= _response.status_code < 300:
|
|
91
|
+
return
|
|
92
|
+
try:
|
|
93
|
+
_response_json = _response.json()
|
|
94
|
+
except JSONDecodeError:
|
|
95
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
96
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
97
|
+
|
|
98
|
+
def update(
|
|
99
|
+
self, id: int, *, request: FileUpload, request_options: typing.Optional[RequestOptions] = None
|
|
100
|
+
) -> FileUpload:
|
|
101
|
+
"""
|
|
102
|
+
Update a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
103
|
+
|
|
104
|
+
You will need to include the file data in the request body. For example:
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
curl -H 'Authorization: Token abc123' \ -X POST 'https://localhost:8080/api/import/file-upload/245' -F ‘file=@path/to/my_file.csv’
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Parameters
|
|
111
|
+
----------
|
|
112
|
+
id : int
|
|
113
|
+
A unique integer value identifying this file upload.
|
|
114
|
+
|
|
115
|
+
request : FileUpload
|
|
116
|
+
|
|
117
|
+
request_options : typing.Optional[RequestOptions]
|
|
118
|
+
Request-specific configuration.
|
|
119
|
+
|
|
120
|
+
Returns
|
|
121
|
+
-------
|
|
122
|
+
FileUpload
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
Examples
|
|
126
|
+
--------
|
|
127
|
+
from label_studio_sdk import FileUpload
|
|
128
|
+
from label_studio_sdk.client import LabelStudio
|
|
129
|
+
|
|
130
|
+
client = LabelStudio(
|
|
131
|
+
api_key="YOUR_API_KEY",
|
|
132
|
+
)
|
|
133
|
+
client.files.update(
|
|
134
|
+
id=1,
|
|
135
|
+
request=FileUpload(),
|
|
136
|
+
)
|
|
137
|
+
"""
|
|
138
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
139
|
+
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
140
|
+
method="PATCH",
|
|
141
|
+
json=request,
|
|
142
|
+
request_options=request_options,
|
|
143
|
+
omit=OMIT,
|
|
144
|
+
)
|
|
145
|
+
if 200 <= _response.status_code < 300:
|
|
146
|
+
return pydantic_v1.parse_obj_as(FileUpload, _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 list(
|
|
154
|
+
self,
|
|
155
|
+
id: int,
|
|
156
|
+
*,
|
|
157
|
+
all_: typing.Optional[bool] = None,
|
|
158
|
+
ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
|
|
159
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
160
|
+
) -> typing.List[FileUpload]:
|
|
161
|
+
"""
|
|
162
|
+
Retrieve the list of uploaded files used to create labeling tasks for a specific project. These are files that have been uploaded directly to Label Studio.
|
|
163
|
+
|
|
164
|
+
You must provide a project ID. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../list).
|
|
165
|
+
|
|
166
|
+
Parameters
|
|
167
|
+
----------
|
|
168
|
+
id : int
|
|
169
|
+
A unique integer value identifying this file upload.
|
|
170
|
+
|
|
171
|
+
all_ : typing.Optional[bool]
|
|
172
|
+
Set to "true" if you want to retrieve all file uploads
|
|
173
|
+
|
|
174
|
+
ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
|
|
175
|
+
Specify the list of file upload IDs to retrieve, e.g. ids=[1,2,3]
|
|
176
|
+
|
|
177
|
+
request_options : typing.Optional[RequestOptions]
|
|
178
|
+
Request-specific configuration.
|
|
179
|
+
|
|
180
|
+
Returns
|
|
181
|
+
-------
|
|
182
|
+
typing.List[FileUpload]
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
Examples
|
|
186
|
+
--------
|
|
187
|
+
from label_studio_sdk.client import LabelStudio
|
|
188
|
+
|
|
189
|
+
client = LabelStudio(
|
|
190
|
+
api_key="YOUR_API_KEY",
|
|
191
|
+
)
|
|
192
|
+
client.files.list(
|
|
193
|
+
id=1,
|
|
194
|
+
)
|
|
195
|
+
"""
|
|
196
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
197
|
+
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
198
|
+
method="GET",
|
|
199
|
+
params={"all": all_, "ids": ids},
|
|
200
|
+
request_options=request_options,
|
|
201
|
+
)
|
|
202
|
+
if 200 <= _response.status_code < 300:
|
|
203
|
+
return pydantic_v1.parse_obj_as(typing.List[FileUpload], _response.json()) # type: ignore
|
|
204
|
+
try:
|
|
205
|
+
_response_json = _response.json()
|
|
206
|
+
except JSONDecodeError:
|
|
207
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
208
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
209
|
+
|
|
210
|
+
def delete_many(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
211
|
+
"""
|
|
212
|
+
Delete uploaded files for a specific project. These are files that have been uploaded directly to Label Studio.
|
|
213
|
+
|
|
214
|
+
You must provide a project ID. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../list).
|
|
215
|
+
|
|
216
|
+
Parameters
|
|
217
|
+
----------
|
|
218
|
+
id : int
|
|
219
|
+
A unique integer value identifying this file upload.
|
|
220
|
+
|
|
221
|
+
request_options : typing.Optional[RequestOptions]
|
|
222
|
+
Request-specific configuration.
|
|
223
|
+
|
|
224
|
+
Returns
|
|
225
|
+
-------
|
|
226
|
+
None
|
|
227
|
+
|
|
228
|
+
Examples
|
|
229
|
+
--------
|
|
230
|
+
from label_studio_sdk.client import LabelStudio
|
|
231
|
+
|
|
232
|
+
client = LabelStudio(
|
|
233
|
+
api_key="YOUR_API_KEY",
|
|
234
|
+
)
|
|
235
|
+
client.files.delete_many(
|
|
236
|
+
id=1,
|
|
237
|
+
)
|
|
238
|
+
"""
|
|
239
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
240
|
+
f"api/projects/{jsonable_encoder(id)}/file-uploads", method="DELETE", request_options=request_options
|
|
241
|
+
)
|
|
242
|
+
if 200 <= _response.status_code < 300:
|
|
243
|
+
return
|
|
244
|
+
try:
|
|
245
|
+
_response_json = _response.json()
|
|
246
|
+
except JSONDecodeError:
|
|
247
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
248
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
249
|
+
|
|
250
|
+
def download(self, filename: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
251
|
+
"""
|
|
252
|
+
Download a specific uploaded file. If you aren't sure of the file name, try [Get files list](list) first.
|
|
253
|
+
|
|
254
|
+
Parameters
|
|
255
|
+
----------
|
|
256
|
+
filename : str
|
|
257
|
+
|
|
258
|
+
request_options : typing.Optional[RequestOptions]
|
|
259
|
+
Request-specific configuration.
|
|
260
|
+
|
|
261
|
+
Returns
|
|
262
|
+
-------
|
|
263
|
+
None
|
|
264
|
+
|
|
265
|
+
Examples
|
|
266
|
+
--------
|
|
267
|
+
from label_studio_sdk.client import LabelStudio
|
|
268
|
+
|
|
269
|
+
client = LabelStudio(
|
|
270
|
+
api_key="YOUR_API_KEY",
|
|
271
|
+
)
|
|
272
|
+
client.files.download(
|
|
273
|
+
filename="filename",
|
|
274
|
+
)
|
|
275
|
+
"""
|
|
276
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
277
|
+
f"data/upload/{jsonable_encoder(filename)}", method="GET", request_options=request_options
|
|
278
|
+
)
|
|
279
|
+
if 200 <= _response.status_code < 300:
|
|
280
|
+
return
|
|
281
|
+
try:
|
|
282
|
+
_response_json = _response.json()
|
|
283
|
+
except JSONDecodeError:
|
|
284
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
285
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
class AsyncFilesClient:
|
|
289
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
290
|
+
self._client_wrapper = client_wrapper
|
|
291
|
+
|
|
292
|
+
async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> FileUpload:
|
|
293
|
+
"""
|
|
294
|
+
Retrieve details about a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
295
|
+
|
|
296
|
+
Parameters
|
|
297
|
+
----------
|
|
298
|
+
id : int
|
|
299
|
+
A unique integer value identifying this file upload.
|
|
300
|
+
|
|
301
|
+
request_options : typing.Optional[RequestOptions]
|
|
302
|
+
Request-specific configuration.
|
|
303
|
+
|
|
304
|
+
Returns
|
|
305
|
+
-------
|
|
306
|
+
FileUpload
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
Examples
|
|
310
|
+
--------
|
|
311
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
312
|
+
|
|
313
|
+
client = AsyncLabelStudio(
|
|
314
|
+
api_key="YOUR_API_KEY",
|
|
315
|
+
)
|
|
316
|
+
await client.files.get(
|
|
317
|
+
id=1,
|
|
318
|
+
)
|
|
319
|
+
"""
|
|
320
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
321
|
+
f"api/import/file-upload/{jsonable_encoder(id)}", method="GET", request_options=request_options
|
|
322
|
+
)
|
|
323
|
+
if 200 <= _response.status_code < 300:
|
|
324
|
+
return pydantic_v1.parse_obj_as(FileUpload, _response.json()) # type: ignore
|
|
325
|
+
try:
|
|
326
|
+
_response_json = _response.json()
|
|
327
|
+
except JSONDecodeError:
|
|
328
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
329
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
330
|
+
|
|
331
|
+
async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
332
|
+
"""
|
|
333
|
+
Delete a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
334
|
+
|
|
335
|
+
Parameters
|
|
336
|
+
----------
|
|
337
|
+
id : int
|
|
338
|
+
A unique integer value identifying this file upload.
|
|
339
|
+
|
|
340
|
+
request_options : typing.Optional[RequestOptions]
|
|
341
|
+
Request-specific configuration.
|
|
342
|
+
|
|
343
|
+
Returns
|
|
344
|
+
-------
|
|
345
|
+
None
|
|
346
|
+
|
|
347
|
+
Examples
|
|
348
|
+
--------
|
|
349
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
350
|
+
|
|
351
|
+
client = AsyncLabelStudio(
|
|
352
|
+
api_key="YOUR_API_KEY",
|
|
353
|
+
)
|
|
354
|
+
await client.files.delete(
|
|
355
|
+
id=1,
|
|
356
|
+
)
|
|
357
|
+
"""
|
|
358
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
359
|
+
f"api/import/file-upload/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
|
|
360
|
+
)
|
|
361
|
+
if 200 <= _response.status_code < 300:
|
|
362
|
+
return
|
|
363
|
+
try:
|
|
364
|
+
_response_json = _response.json()
|
|
365
|
+
except JSONDecodeError:
|
|
366
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
367
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
368
|
+
|
|
369
|
+
async def update(
|
|
370
|
+
self, id: int, *, request: FileUpload, request_options: typing.Optional[RequestOptions] = None
|
|
371
|
+
) -> FileUpload:
|
|
372
|
+
"""
|
|
373
|
+
Update a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
374
|
+
|
|
375
|
+
You will need to include the file data in the request body. For example:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
curl -H 'Authorization: Token abc123' \ -X POST 'https://localhost:8080/api/import/file-upload/245' -F ‘file=@path/to/my_file.csv’
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
Parameters
|
|
382
|
+
----------
|
|
383
|
+
id : int
|
|
384
|
+
A unique integer value identifying this file upload.
|
|
385
|
+
|
|
386
|
+
request : FileUpload
|
|
387
|
+
|
|
388
|
+
request_options : typing.Optional[RequestOptions]
|
|
389
|
+
Request-specific configuration.
|
|
390
|
+
|
|
391
|
+
Returns
|
|
392
|
+
-------
|
|
393
|
+
FileUpload
|
|
394
|
+
|
|
395
|
+
|
|
396
|
+
Examples
|
|
397
|
+
--------
|
|
398
|
+
from label_studio_sdk import FileUpload
|
|
399
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
400
|
+
|
|
401
|
+
client = AsyncLabelStudio(
|
|
402
|
+
api_key="YOUR_API_KEY",
|
|
403
|
+
)
|
|
404
|
+
await client.files.update(
|
|
405
|
+
id=1,
|
|
406
|
+
request=FileUpload(),
|
|
407
|
+
)
|
|
408
|
+
"""
|
|
409
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
410
|
+
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
411
|
+
method="PATCH",
|
|
412
|
+
json=request,
|
|
413
|
+
request_options=request_options,
|
|
414
|
+
omit=OMIT,
|
|
415
|
+
)
|
|
416
|
+
if 200 <= _response.status_code < 300:
|
|
417
|
+
return pydantic_v1.parse_obj_as(FileUpload, _response.json()) # type: ignore
|
|
418
|
+
try:
|
|
419
|
+
_response_json = _response.json()
|
|
420
|
+
except JSONDecodeError:
|
|
421
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
422
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
423
|
+
|
|
424
|
+
async def list(
|
|
425
|
+
self,
|
|
426
|
+
id: int,
|
|
427
|
+
*,
|
|
428
|
+
all_: typing.Optional[bool] = None,
|
|
429
|
+
ids: typing.Optional[typing.Union[int, typing.Sequence[int]]] = None,
|
|
430
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
431
|
+
) -> typing.List[FileUpload]:
|
|
432
|
+
"""
|
|
433
|
+
Retrieve the list of uploaded files used to create labeling tasks for a specific project. These are files that have been uploaded directly to Label Studio.
|
|
434
|
+
|
|
435
|
+
You must provide a project ID. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../list).
|
|
436
|
+
|
|
437
|
+
Parameters
|
|
438
|
+
----------
|
|
439
|
+
id : int
|
|
440
|
+
A unique integer value identifying this file upload.
|
|
441
|
+
|
|
442
|
+
all_ : typing.Optional[bool]
|
|
443
|
+
Set to "true" if you want to retrieve all file uploads
|
|
444
|
+
|
|
445
|
+
ids : typing.Optional[typing.Union[int, typing.Sequence[int]]]
|
|
446
|
+
Specify the list of file upload IDs to retrieve, e.g. ids=[1,2,3]
|
|
447
|
+
|
|
448
|
+
request_options : typing.Optional[RequestOptions]
|
|
449
|
+
Request-specific configuration.
|
|
450
|
+
|
|
451
|
+
Returns
|
|
452
|
+
-------
|
|
453
|
+
typing.List[FileUpload]
|
|
454
|
+
|
|
455
|
+
|
|
456
|
+
Examples
|
|
457
|
+
--------
|
|
458
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
459
|
+
|
|
460
|
+
client = AsyncLabelStudio(
|
|
461
|
+
api_key="YOUR_API_KEY",
|
|
462
|
+
)
|
|
463
|
+
await client.files.list(
|
|
464
|
+
id=1,
|
|
465
|
+
)
|
|
466
|
+
"""
|
|
467
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
468
|
+
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
469
|
+
method="GET",
|
|
470
|
+
params={"all": all_, "ids": ids},
|
|
471
|
+
request_options=request_options,
|
|
472
|
+
)
|
|
473
|
+
if 200 <= _response.status_code < 300:
|
|
474
|
+
return pydantic_v1.parse_obj_as(typing.List[FileUpload], _response.json()) # type: ignore
|
|
475
|
+
try:
|
|
476
|
+
_response_json = _response.json()
|
|
477
|
+
except JSONDecodeError:
|
|
478
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
479
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
480
|
+
|
|
481
|
+
async def delete_many(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
482
|
+
"""
|
|
483
|
+
Delete uploaded files for a specific project. These are files that have been uploaded directly to Label Studio.
|
|
484
|
+
|
|
485
|
+
You must provide a project ID. The project ID can be found in the URL when viewing the project in Label Studio, or you can retrieve all project IDs using [List all projects](../list).
|
|
486
|
+
|
|
487
|
+
Parameters
|
|
488
|
+
----------
|
|
489
|
+
id : int
|
|
490
|
+
A unique integer value identifying this file upload.
|
|
491
|
+
|
|
492
|
+
request_options : typing.Optional[RequestOptions]
|
|
493
|
+
Request-specific configuration.
|
|
494
|
+
|
|
495
|
+
Returns
|
|
496
|
+
-------
|
|
497
|
+
None
|
|
498
|
+
|
|
499
|
+
Examples
|
|
500
|
+
--------
|
|
501
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
502
|
+
|
|
503
|
+
client = AsyncLabelStudio(
|
|
504
|
+
api_key="YOUR_API_KEY",
|
|
505
|
+
)
|
|
506
|
+
await client.files.delete_many(
|
|
507
|
+
id=1,
|
|
508
|
+
)
|
|
509
|
+
"""
|
|
510
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
511
|
+
f"api/projects/{jsonable_encoder(id)}/file-uploads", method="DELETE", request_options=request_options
|
|
512
|
+
)
|
|
513
|
+
if 200 <= _response.status_code < 300:
|
|
514
|
+
return
|
|
515
|
+
try:
|
|
516
|
+
_response_json = _response.json()
|
|
517
|
+
except JSONDecodeError:
|
|
518
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
519
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
520
|
+
|
|
521
|
+
async def download(self, filename: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
522
|
+
"""
|
|
523
|
+
Download a specific uploaded file. If you aren't sure of the file name, try [Get files list](list) first.
|
|
524
|
+
|
|
525
|
+
Parameters
|
|
526
|
+
----------
|
|
527
|
+
filename : str
|
|
528
|
+
|
|
529
|
+
request_options : typing.Optional[RequestOptions]
|
|
530
|
+
Request-specific configuration.
|
|
531
|
+
|
|
532
|
+
Returns
|
|
533
|
+
-------
|
|
534
|
+
None
|
|
535
|
+
|
|
536
|
+
Examples
|
|
537
|
+
--------
|
|
538
|
+
from label_studio_sdk.client import AsyncLabelStudio
|
|
539
|
+
|
|
540
|
+
client = AsyncLabelStudio(
|
|
541
|
+
api_key="YOUR_API_KEY",
|
|
542
|
+
)
|
|
543
|
+
await client.files.download(
|
|
544
|
+
filename="filename",
|
|
545
|
+
)
|
|
546
|
+
"""
|
|
547
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
548
|
+
f"data/upload/{jsonable_encoder(filename)}", method="GET", request_options=request_options
|
|
549
|
+
)
|
|
550
|
+
if 200 <= _response.status_code < 300:
|
|
551
|
+
return
|
|
552
|
+
try:
|
|
553
|
+
_response_json = _response.json()
|
|
554
|
+
except JSONDecodeError:
|
|
555
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
556
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# This file was auto-generated by Fern from our API Definition.
|
|
2
|
+
|
|
3
|
+
from .types import ImportStorageListTypesResponseItem
|
|
4
|
+
from . import azure, gcs, local, redis, s3
|
|
5
|
+
from .azure import AzureCreateResponse, AzureUpdateResponse
|
|
6
|
+
from .gcs import GcsCreateResponse, GcsUpdateResponse
|
|
7
|
+
from .local import LocalCreateResponse, LocalUpdateResponse
|
|
8
|
+
from .redis import RedisCreateResponse, RedisUpdateResponse
|
|
9
|
+
from .s3 import S3CreateResponse, S3UpdateResponse
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"AzureCreateResponse",
|
|
13
|
+
"AzureUpdateResponse",
|
|
14
|
+
"GcsCreateResponse",
|
|
15
|
+
"GcsUpdateResponse",
|
|
16
|
+
"ImportStorageListTypesResponseItem",
|
|
17
|
+
"LocalCreateResponse",
|
|
18
|
+
"LocalUpdateResponse",
|
|
19
|
+
"RedisCreateResponse",
|
|
20
|
+
"RedisUpdateResponse",
|
|
21
|
+
"S3CreateResponse",
|
|
22
|
+
"S3UpdateResponse",
|
|
23
|
+
"azure",
|
|
24
|
+
"gcs",
|
|
25
|
+
"local",
|
|
26
|
+
"redis",
|
|
27
|
+
"s3",
|
|
28
|
+
]
|