label-studio-sdk 1.0.8__py3-none-any.whl → 1.0.10__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 +20 -7
- label_studio_sdk/_extensions/label_studio_tools/core/utils/io.py +16 -4
- label_studio_sdk/_extensions/pager_ext.py +8 -0
- label_studio_sdk/actions/client.py +91 -40
- label_studio_sdk/actions/types/actions_create_request_filters.py +14 -24
- label_studio_sdk/actions/types/actions_create_request_filters_items_item.py +16 -26
- label_studio_sdk/actions/types/actions_create_request_filters_items_item_value.py +3 -1
- label_studio_sdk/actions/types/actions_create_request_selected_items.py +1 -2
- label_studio_sdk/actions/types/actions_create_request_selected_items_excluded.py +15 -25
- label_studio_sdk/actions/types/actions_create_request_selected_items_included.py +15 -25
- label_studio_sdk/annotations/__init__.py +2 -2
- label_studio_sdk/annotations/client.py +278 -104
- label_studio_sdk/annotations/types/__init__.py +2 -1
- label_studio_sdk/annotations/types/annotations_create_bulk_request_selected_items.py +34 -0
- label_studio_sdk/annotations/types/annotations_create_bulk_response_item.py +11 -21
- label_studio_sdk/base_client.py +46 -27
- label_studio_sdk/client.py +1 -0
- label_studio_sdk/comments/client.py +190 -44
- label_studio_sdk/converter/converter.py +56 -13
- label_studio_sdk/converter/imports/yolo.py +1 -1
- label_studio_sdk/converter/utils.py +3 -2
- label_studio_sdk/core/__init__.py +21 -4
- label_studio_sdk/core/client_wrapper.py +9 -10
- label_studio_sdk/core/file.py +37 -8
- label_studio_sdk/core/http_client.py +52 -28
- label_studio_sdk/core/jsonable_encoder.py +33 -31
- label_studio_sdk/core/pagination.py +5 -4
- label_studio_sdk/core/pydantic_utilities.py +272 -4
- label_studio_sdk/core/query_encoder.py +38 -13
- label_studio_sdk/core/request_options.py +3 -0
- label_studio_sdk/core/serialization.py +272 -0
- label_studio_sdk/errors/bad_request_error.py +2 -3
- label_studio_sdk/export_storage/azure/client.py +228 -58
- label_studio_sdk/export_storage/azure/types/azure_create_response.py +19 -29
- label_studio_sdk/export_storage/azure/types/azure_update_response.py +19 -29
- label_studio_sdk/export_storage/client.py +48 -18
- label_studio_sdk/export_storage/gcs/client.py +228 -58
- label_studio_sdk/export_storage/gcs/types/gcs_create_response.py +19 -29
- label_studio_sdk/export_storage/gcs/types/gcs_update_response.py +19 -29
- label_studio_sdk/export_storage/local/client.py +222 -56
- label_studio_sdk/export_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/export_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/export_storage/redis/client.py +228 -58
- label_studio_sdk/export_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/export_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/export_storage/s3/client.py +228 -58
- label_studio_sdk/export_storage/s3/types/s3create_response.py +27 -35
- label_studio_sdk/export_storage/s3/types/s3update_response.py +27 -35
- label_studio_sdk/export_storage/s3s/client.py +187 -43
- label_studio_sdk/export_storage/types/export_storage_list_types_response_item.py +11 -21
- label_studio_sdk/files/client.py +172 -56
- label_studio_sdk/import_storage/azure/client.py +223 -53
- label_studio_sdk/import_storage/azure/types/azure_create_response.py +22 -32
- label_studio_sdk/import_storage/azure/types/azure_update_response.py +22 -32
- label_studio_sdk/import_storage/client.py +48 -18
- label_studio_sdk/import_storage/gcs/client.py +223 -53
- label_studio_sdk/import_storage/gcs/types/gcs_create_response.py +22 -32
- label_studio_sdk/import_storage/gcs/types/gcs_update_response.py +22 -32
- label_studio_sdk/import_storage/local/client.py +223 -53
- label_studio_sdk/import_storage/local/types/local_create_response.py +17 -27
- label_studio_sdk/import_storage/local/types/local_update_response.py +17 -27
- label_studio_sdk/import_storage/redis/client.py +223 -53
- label_studio_sdk/import_storage/redis/types/redis_create_response.py +20 -30
- label_studio_sdk/import_storage/redis/types/redis_update_response.py +20 -30
- label_studio_sdk/import_storage/s3/client.py +223 -53
- label_studio_sdk/import_storage/s3/types/s3create_response.py +31 -39
- label_studio_sdk/import_storage/s3/types/s3update_response.py +31 -39
- label_studio_sdk/import_storage/s3s/client.py +222 -52
- label_studio_sdk/import_storage/types/import_storage_list_types_response_item.py +11 -21
- label_studio_sdk/label_interface/control_tags.py +1 -1
- label_studio_sdk/ml/client.py +280 -78
- label_studio_sdk/ml/types/ml_create_response.py +21 -31
- label_studio_sdk/ml/types/ml_update_response.py +21 -31
- label_studio_sdk/model_providers/client.py +173 -56
- label_studio_sdk/predictions/client.py +247 -101
- label_studio_sdk/projects/__init__.py +3 -0
- label_studio_sdk/projects/client.py +309 -115
- label_studio_sdk/projects/client_ext.py +16 -0
- label_studio_sdk/projects/exports/__init__.py +3 -0
- label_studio_sdk/projects/exports/client.py +447 -296
- label_studio_sdk/projects/exports/client_ext.py +134 -0
- label_studio_sdk/projects/exports/types/__init__.py +6 -0
- label_studio_sdk/projects/exports/types/exports_convert_response.py +24 -0
- label_studio_sdk/projects/exports/types/exports_list_formats_response_item.py +44 -0
- label_studio_sdk/projects/types/projects_create_response.py +29 -34
- label_studio_sdk/projects/types/projects_import_tasks_response.py +19 -29
- label_studio_sdk/projects/types/projects_list_response.py +11 -21
- label_studio_sdk/projects/types/projects_update_response.py +24 -34
- label_studio_sdk/prompts/client.py +309 -92
- label_studio_sdk/prompts/indicators/client.py +67 -23
- label_studio_sdk/prompts/runs/client.py +95 -40
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_request_failed_predictions_item.py +14 -24
- label_studio_sdk/prompts/types/prompts_batch_failed_predictions_response.py +11 -21
- label_studio_sdk/prompts/types/prompts_batch_predictions_request_results_item.py +26 -29
- label_studio_sdk/prompts/types/prompts_batch_predictions_response.py +11 -21
- label_studio_sdk/prompts/versions/client.py +277 -88
- label_studio_sdk/tasks/client.py +263 -90
- label_studio_sdk/tasks/types/tasks_list_response.py +15 -25
- label_studio_sdk/types/__init__.py +10 -6
- label_studio_sdk/types/annotation.py +29 -38
- label_studio_sdk/types/annotation_filter_options.py +14 -24
- label_studio_sdk/types/annotations_dm_field.py +30 -39
- label_studio_sdk/types/azure_blob_export_storage.py +28 -37
- label_studio_sdk/types/azure_blob_import_storage.py +28 -37
- label_studio_sdk/types/base_task.py +30 -39
- label_studio_sdk/types/base_task_updated_by.py +3 -1
- label_studio_sdk/types/base_user.py +14 -21
- label_studio_sdk/types/comment.py +12 -21
- label_studio_sdk/types/comment_created_by.py +1 -1
- label_studio_sdk/types/converted_format.py +12 -22
- label_studio_sdk/types/data_manager_task_serializer.py +31 -40
- label_studio_sdk/types/data_manager_task_serializer_annotators_item.py +1 -1
- label_studio_sdk/types/data_manager_task_serializer_drafts_item.py +13 -22
- label_studio_sdk/types/data_manager_task_serializer_predictions_item.py +15 -24
- label_studio_sdk/types/export.py +17 -26
- label_studio_sdk/types/export_format.py +25 -0
- label_studio_sdk/types/export_snapshot.py +45 -0
- label_studio_sdk/types/export_snapshot_status.py +5 -0
- label_studio_sdk/types/file_upload.py +11 -21
- label_studio_sdk/types/filter.py +16 -26
- label_studio_sdk/types/filter_group.py +12 -22
- label_studio_sdk/types/gcs_export_storage.py +28 -37
- label_studio_sdk/types/gcs_import_storage.py +28 -37
- label_studio_sdk/types/inference_run.py +14 -23
- label_studio_sdk/types/inference_run_cost_estimate.py +17 -27
- label_studio_sdk/types/inference_run_created_by.py +1 -1
- label_studio_sdk/types/inference_run_organization.py +1 -1
- label_studio_sdk/types/key_indicator_value.py +12 -22
- label_studio_sdk/types/key_indicators.py +0 -1
- label_studio_sdk/types/key_indicators_item.py +15 -25
- label_studio_sdk/types/key_indicators_item_additional_kpis_item.py +13 -23
- label_studio_sdk/types/key_indicators_item_extra_kpis_item.py +13 -23
- label_studio_sdk/types/local_files_export_storage.py +25 -34
- label_studio_sdk/types/local_files_import_storage.py +24 -33
- label_studio_sdk/types/ml_backend.py +23 -32
- label_studio_sdk/types/model_provider_connection.py +22 -31
- label_studio_sdk/types/model_provider_connection_created_by.py +1 -1
- label_studio_sdk/types/model_provider_connection_organization.py +1 -1
- label_studio_sdk/types/model_provider_connection_provider.py +3 -1
- label_studio_sdk/types/prediction.py +21 -30
- label_studio_sdk/types/project.py +48 -55
- label_studio_sdk/types/project_import.py +21 -30
- label_studio_sdk/types/project_label_config.py +12 -22
- label_studio_sdk/types/prompt.py +24 -32
- label_studio_sdk/types/prompt_associated_projects_item.py +6 -0
- label_studio_sdk/types/prompt_associated_projects_item_id.py +20 -0
- label_studio_sdk/types/prompt_created_by.py +1 -1
- label_studio_sdk/types/prompt_organization.py +1 -1
- label_studio_sdk/types/prompt_version.py +13 -22
- label_studio_sdk/types/prompt_version_created_by.py +1 -1
- label_studio_sdk/types/prompt_version_organization.py +1 -1
- label_studio_sdk/types/prompt_version_provider.py +3 -1
- label_studio_sdk/types/redis_export_storage.py +29 -38
- label_studio_sdk/types/redis_import_storage.py +28 -37
- label_studio_sdk/types/refined_prompt_response.py +19 -29
- label_studio_sdk/types/s3export_storage.py +36 -43
- label_studio_sdk/types/s3import_storage.py +37 -44
- label_studio_sdk/types/s3s_export_storage.py +26 -33
- label_studio_sdk/types/s3s_import_storage.py +35 -42
- label_studio_sdk/types/serialization_option.py +12 -22
- label_studio_sdk/types/serialization_options.py +18 -28
- label_studio_sdk/types/task.py +44 -47
- label_studio_sdk/types/task_annotators_item.py +1 -1
- label_studio_sdk/types/task_comment_authors_item.py +1 -1
- label_studio_sdk/types/task_filter_options.py +15 -25
- label_studio_sdk/types/user_simple.py +11 -21
- label_studio_sdk/types/view.py +16 -26
- label_studio_sdk/types/webhook.py +19 -28
- label_studio_sdk/types/webhook_serializer_for_update.py +19 -28
- label_studio_sdk/types/workspace.py +22 -31
- label_studio_sdk/users/client.py +257 -63
- label_studio_sdk/users/types/users_get_token_response.py +12 -22
- label_studio_sdk/users/types/users_reset_token_response.py +12 -22
- label_studio_sdk/version.py +0 -1
- label_studio_sdk/versions/__init__.py +5 -0
- label_studio_sdk/versions/client.py +112 -0
- label_studio_sdk/versions/types/__init__.py +6 -0
- label_studio_sdk/versions/types/versions_get_response.py +73 -0
- label_studio_sdk/versions/types/versions_get_response_edition.py +5 -0
- label_studio_sdk/views/client.py +219 -52
- label_studio_sdk/views/types/views_create_request_data.py +13 -23
- label_studio_sdk/views/types/views_create_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_create_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_create_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/views/types/views_update_request_data.py +13 -23
- label_studio_sdk/views/types/views_update_request_data_filters.py +14 -24
- label_studio_sdk/views/types/views_update_request_data_filters_items_item.py +16 -26
- label_studio_sdk/views/types/views_update_request_data_filters_items_item_value.py +3 -1
- label_studio_sdk/webhooks/client.py +191 -61
- label_studio_sdk/workspaces/client.py +164 -41
- label_studio_sdk/workspaces/members/client.py +109 -31
- label_studio_sdk/workspaces/members/types/members_create_response.py +12 -22
- label_studio_sdk/workspaces/members/types/members_list_response_item.py +12 -22
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/METADATA +7 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/RECORD +197 -184
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/WHEEL +1 -1
- label_studio_sdk/types/export_convert.py +0 -32
- label_studio_sdk/types/export_create.py +0 -54
- label_studio_sdk/types/export_create_status.py +0 -5
- {label_studio_sdk-1.0.8.dist-info → label_studio_sdk-1.0.10.dist-info}/LICENSE +0 -0
label_studio_sdk/files/client.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
# This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
|
|
3
3
|
import typing
|
|
4
|
-
from
|
|
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
|
|
4
|
+
from ..core.client_wrapper import SyncClientWrapper
|
|
10
5
|
from ..core.request_options import RequestOptions
|
|
11
6
|
from ..types.file_upload import FileUpload
|
|
7
|
+
from ..core.jsonable_encoder import jsonable_encoder
|
|
8
|
+
from ..core.pydantic_utilities import parse_obj_as
|
|
9
|
+
from json.decoder import JSONDecodeError
|
|
10
|
+
from ..core.api_error import ApiError
|
|
11
|
+
from ..core.client_wrapper import AsyncClientWrapper
|
|
12
12
|
|
|
13
13
|
# this is used as the default value for optional parameters
|
|
14
14
|
OMIT = typing.cast(typing.Any, ...)
|
|
@@ -37,7 +37,7 @@ class FilesClient:
|
|
|
37
37
|
|
|
38
38
|
Examples
|
|
39
39
|
--------
|
|
40
|
-
from label_studio_sdk
|
|
40
|
+
from label_studio_sdk import LabelStudio
|
|
41
41
|
|
|
42
42
|
client = LabelStudio(
|
|
43
43
|
api_key="YOUR_API_KEY",
|
|
@@ -47,11 +47,19 @@ class FilesClient:
|
|
|
47
47
|
)
|
|
48
48
|
"""
|
|
49
49
|
_response = self._client_wrapper.httpx_client.request(
|
|
50
|
-
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
50
|
+
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
51
|
+
method="GET",
|
|
52
|
+
request_options=request_options,
|
|
51
53
|
)
|
|
52
54
|
try:
|
|
53
55
|
if 200 <= _response.status_code < 300:
|
|
54
|
-
return
|
|
56
|
+
return typing.cast(
|
|
57
|
+
FileUpload,
|
|
58
|
+
parse_obj_as(
|
|
59
|
+
type_=FileUpload, # type: ignore
|
|
60
|
+
object_=_response.json(),
|
|
61
|
+
),
|
|
62
|
+
)
|
|
55
63
|
_response_json = _response.json()
|
|
56
64
|
except JSONDecodeError:
|
|
57
65
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -75,7 +83,7 @@ class FilesClient:
|
|
|
75
83
|
|
|
76
84
|
Examples
|
|
77
85
|
--------
|
|
78
|
-
from label_studio_sdk
|
|
86
|
+
from label_studio_sdk import LabelStudio
|
|
79
87
|
|
|
80
88
|
client = LabelStudio(
|
|
81
89
|
api_key="YOUR_API_KEY",
|
|
@@ -85,7 +93,9 @@ class FilesClient:
|
|
|
85
93
|
)
|
|
86
94
|
"""
|
|
87
95
|
_response = self._client_wrapper.httpx_client.request(
|
|
88
|
-
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
96
|
+
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
97
|
+
method="DELETE",
|
|
98
|
+
request_options=request_options,
|
|
89
99
|
)
|
|
90
100
|
try:
|
|
91
101
|
if 200 <= _response.status_code < 300:
|
|
@@ -104,10 +114,10 @@ class FilesClient:
|
|
|
104
114
|
request_options: typing.Optional[RequestOptions] = None,
|
|
105
115
|
) -> FileUpload:
|
|
106
116
|
"""
|
|
117
|
+
|
|
107
118
|
Update a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
108
119
|
|
|
109
120
|
You will need to include the file data in the request body. For example:
|
|
110
|
-
|
|
111
121
|
```bash
|
|
112
122
|
curl -H 'Authorization: Token abc123' \ -X POST 'https://localhost:8080/api/import/file-upload/245' -F ‘file=@path/to/my_file.csv’
|
|
113
123
|
```
|
|
@@ -131,7 +141,7 @@ class FilesClient:
|
|
|
131
141
|
|
|
132
142
|
Examples
|
|
133
143
|
--------
|
|
134
|
-
from label_studio_sdk
|
|
144
|
+
from label_studio_sdk import LabelStudio
|
|
135
145
|
|
|
136
146
|
client = LabelStudio(
|
|
137
147
|
api_key="YOUR_API_KEY",
|
|
@@ -143,13 +153,22 @@ class FilesClient:
|
|
|
143
153
|
_response = self._client_wrapper.httpx_client.request(
|
|
144
154
|
f"api/import/file-upload/{jsonable_encoder(id_)}",
|
|
145
155
|
method="PATCH",
|
|
146
|
-
json={
|
|
156
|
+
json={
|
|
157
|
+
"id": id,
|
|
158
|
+
"file": file,
|
|
159
|
+
},
|
|
147
160
|
request_options=request_options,
|
|
148
161
|
omit=OMIT,
|
|
149
162
|
)
|
|
150
163
|
try:
|
|
151
164
|
if 200 <= _response.status_code < 300:
|
|
152
|
-
return
|
|
165
|
+
return typing.cast(
|
|
166
|
+
FileUpload,
|
|
167
|
+
parse_obj_as(
|
|
168
|
+
type_=FileUpload, # type: ignore
|
|
169
|
+
object_=_response.json(),
|
|
170
|
+
),
|
|
171
|
+
)
|
|
153
172
|
_response_json = _response.json()
|
|
154
173
|
except JSONDecodeError:
|
|
155
174
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -164,6 +183,7 @@ class FilesClient:
|
|
|
164
183
|
request_options: typing.Optional[RequestOptions] = None,
|
|
165
184
|
) -> typing.List[FileUpload]:
|
|
166
185
|
"""
|
|
186
|
+
|
|
167
187
|
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.
|
|
168
188
|
|
|
169
189
|
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).
|
|
@@ -189,7 +209,7 @@ class FilesClient:
|
|
|
189
209
|
|
|
190
210
|
Examples
|
|
191
211
|
--------
|
|
192
|
-
from label_studio_sdk
|
|
212
|
+
from label_studio_sdk import LabelStudio
|
|
193
213
|
|
|
194
214
|
client = LabelStudio(
|
|
195
215
|
api_key="YOUR_API_KEY",
|
|
@@ -201,12 +221,21 @@ class FilesClient:
|
|
|
201
221
|
_response = self._client_wrapper.httpx_client.request(
|
|
202
222
|
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
203
223
|
method="GET",
|
|
204
|
-
params={
|
|
224
|
+
params={
|
|
225
|
+
"all": all_,
|
|
226
|
+
"ids": ids,
|
|
227
|
+
},
|
|
205
228
|
request_options=request_options,
|
|
206
229
|
)
|
|
207
230
|
try:
|
|
208
231
|
if 200 <= _response.status_code < 300:
|
|
209
|
-
return
|
|
232
|
+
return typing.cast(
|
|
233
|
+
typing.List[FileUpload],
|
|
234
|
+
parse_obj_as(
|
|
235
|
+
type_=typing.List[FileUpload], # type: ignore
|
|
236
|
+
object_=_response.json(),
|
|
237
|
+
),
|
|
238
|
+
)
|
|
210
239
|
_response_json = _response.json()
|
|
211
240
|
except JSONDecodeError:
|
|
212
241
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -214,6 +243,7 @@ class FilesClient:
|
|
|
214
243
|
|
|
215
244
|
def delete_many(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
216
245
|
"""
|
|
246
|
+
|
|
217
247
|
Delete uploaded files for a specific project. These are files that have been uploaded directly to Label Studio.
|
|
218
248
|
|
|
219
249
|
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).
|
|
@@ -232,7 +262,7 @@ class FilesClient:
|
|
|
232
262
|
|
|
233
263
|
Examples
|
|
234
264
|
--------
|
|
235
|
-
from label_studio_sdk
|
|
265
|
+
from label_studio_sdk import LabelStudio
|
|
236
266
|
|
|
237
267
|
client = LabelStudio(
|
|
238
268
|
api_key="YOUR_API_KEY",
|
|
@@ -242,7 +272,9 @@ class FilesClient:
|
|
|
242
272
|
)
|
|
243
273
|
"""
|
|
244
274
|
_response = self._client_wrapper.httpx_client.request(
|
|
245
|
-
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
275
|
+
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
276
|
+
method="DELETE",
|
|
277
|
+
request_options=request_options,
|
|
246
278
|
)
|
|
247
279
|
try:
|
|
248
280
|
if 200 <= _response.status_code < 300:
|
|
@@ -269,7 +301,7 @@ class FilesClient:
|
|
|
269
301
|
|
|
270
302
|
Examples
|
|
271
303
|
--------
|
|
272
|
-
from label_studio_sdk
|
|
304
|
+
from label_studio_sdk import LabelStudio
|
|
273
305
|
|
|
274
306
|
client = LabelStudio(
|
|
275
307
|
api_key="YOUR_API_KEY",
|
|
@@ -279,7 +311,9 @@ class FilesClient:
|
|
|
279
311
|
)
|
|
280
312
|
"""
|
|
281
313
|
_response = self._client_wrapper.httpx_client.request(
|
|
282
|
-
f"data/upload/{jsonable_encoder(filename)}",
|
|
314
|
+
f"data/upload/{jsonable_encoder(filename)}",
|
|
315
|
+
method="GET",
|
|
316
|
+
request_options=request_options,
|
|
283
317
|
)
|
|
284
318
|
try:
|
|
285
319
|
if 200 <= _response.status_code < 300:
|
|
@@ -313,21 +347,37 @@ class AsyncFilesClient:
|
|
|
313
347
|
|
|
314
348
|
Examples
|
|
315
349
|
--------
|
|
316
|
-
|
|
350
|
+
import asyncio
|
|
351
|
+
|
|
352
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
317
353
|
|
|
318
354
|
client = AsyncLabelStudio(
|
|
319
355
|
api_key="YOUR_API_KEY",
|
|
320
356
|
)
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
)
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
async def main() -> None:
|
|
360
|
+
await client.files.get(
|
|
361
|
+
id=1,
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
asyncio.run(main())
|
|
324
366
|
"""
|
|
325
367
|
_response = await self._client_wrapper.httpx_client.request(
|
|
326
|
-
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
368
|
+
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
369
|
+
method="GET",
|
|
370
|
+
request_options=request_options,
|
|
327
371
|
)
|
|
328
372
|
try:
|
|
329
373
|
if 200 <= _response.status_code < 300:
|
|
330
|
-
return
|
|
374
|
+
return typing.cast(
|
|
375
|
+
FileUpload,
|
|
376
|
+
parse_obj_as(
|
|
377
|
+
type_=FileUpload, # type: ignore
|
|
378
|
+
object_=_response.json(),
|
|
379
|
+
),
|
|
380
|
+
)
|
|
331
381
|
_response_json = _response.json()
|
|
332
382
|
except JSONDecodeError:
|
|
333
383
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -351,17 +401,27 @@ class AsyncFilesClient:
|
|
|
351
401
|
|
|
352
402
|
Examples
|
|
353
403
|
--------
|
|
354
|
-
|
|
404
|
+
import asyncio
|
|
405
|
+
|
|
406
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
355
407
|
|
|
356
408
|
client = AsyncLabelStudio(
|
|
357
409
|
api_key="YOUR_API_KEY",
|
|
358
410
|
)
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
)
|
|
411
|
+
|
|
412
|
+
|
|
413
|
+
async def main() -> None:
|
|
414
|
+
await client.files.delete(
|
|
415
|
+
id=1,
|
|
416
|
+
)
|
|
417
|
+
|
|
418
|
+
|
|
419
|
+
asyncio.run(main())
|
|
362
420
|
"""
|
|
363
421
|
_response = await self._client_wrapper.httpx_client.request(
|
|
364
|
-
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
422
|
+
f"api/import/file-upload/{jsonable_encoder(id)}",
|
|
423
|
+
method="DELETE",
|
|
424
|
+
request_options=request_options,
|
|
365
425
|
)
|
|
366
426
|
try:
|
|
367
427
|
if 200 <= _response.status_code < 300:
|
|
@@ -380,10 +440,10 @@ class AsyncFilesClient:
|
|
|
380
440
|
request_options: typing.Optional[RequestOptions] = None,
|
|
381
441
|
) -> FileUpload:
|
|
382
442
|
"""
|
|
443
|
+
|
|
383
444
|
Update a specific uploaded file. To get the file upload ID, use [Get files list](list).
|
|
384
445
|
|
|
385
446
|
You will need to include the file data in the request body. For example:
|
|
386
|
-
|
|
387
447
|
```bash
|
|
388
448
|
curl -H 'Authorization: Token abc123' \ -X POST 'https://localhost:8080/api/import/file-upload/245' -F ‘file=@path/to/my_file.csv’
|
|
389
449
|
```
|
|
@@ -407,25 +467,42 @@ class AsyncFilesClient:
|
|
|
407
467
|
|
|
408
468
|
Examples
|
|
409
469
|
--------
|
|
410
|
-
|
|
470
|
+
import asyncio
|
|
471
|
+
|
|
472
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
411
473
|
|
|
412
474
|
client = AsyncLabelStudio(
|
|
413
475
|
api_key="YOUR_API_KEY",
|
|
414
476
|
)
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
)
|
|
477
|
+
|
|
478
|
+
|
|
479
|
+
async def main() -> None:
|
|
480
|
+
await client.files.update(
|
|
481
|
+
id_=1,
|
|
482
|
+
)
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
asyncio.run(main())
|
|
418
486
|
"""
|
|
419
487
|
_response = await self._client_wrapper.httpx_client.request(
|
|
420
488
|
f"api/import/file-upload/{jsonable_encoder(id_)}",
|
|
421
489
|
method="PATCH",
|
|
422
|
-
json={
|
|
490
|
+
json={
|
|
491
|
+
"id": id,
|
|
492
|
+
"file": file,
|
|
493
|
+
},
|
|
423
494
|
request_options=request_options,
|
|
424
495
|
omit=OMIT,
|
|
425
496
|
)
|
|
426
497
|
try:
|
|
427
498
|
if 200 <= _response.status_code < 300:
|
|
428
|
-
return
|
|
499
|
+
return typing.cast(
|
|
500
|
+
FileUpload,
|
|
501
|
+
parse_obj_as(
|
|
502
|
+
type_=FileUpload, # type: ignore
|
|
503
|
+
object_=_response.json(),
|
|
504
|
+
),
|
|
505
|
+
)
|
|
429
506
|
_response_json = _response.json()
|
|
430
507
|
except JSONDecodeError:
|
|
431
508
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -440,6 +517,7 @@ class AsyncFilesClient:
|
|
|
440
517
|
request_options: typing.Optional[RequestOptions] = None,
|
|
441
518
|
) -> typing.List[FileUpload]:
|
|
442
519
|
"""
|
|
520
|
+
|
|
443
521
|
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.
|
|
444
522
|
|
|
445
523
|
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).
|
|
@@ -465,24 +543,41 @@ class AsyncFilesClient:
|
|
|
465
543
|
|
|
466
544
|
Examples
|
|
467
545
|
--------
|
|
468
|
-
|
|
546
|
+
import asyncio
|
|
547
|
+
|
|
548
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
469
549
|
|
|
470
550
|
client = AsyncLabelStudio(
|
|
471
551
|
api_key="YOUR_API_KEY",
|
|
472
552
|
)
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
)
|
|
553
|
+
|
|
554
|
+
|
|
555
|
+
async def main() -> None:
|
|
556
|
+
await client.files.list(
|
|
557
|
+
id=1,
|
|
558
|
+
)
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
asyncio.run(main())
|
|
476
562
|
"""
|
|
477
563
|
_response = await self._client_wrapper.httpx_client.request(
|
|
478
564
|
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
479
565
|
method="GET",
|
|
480
|
-
params={
|
|
566
|
+
params={
|
|
567
|
+
"all": all_,
|
|
568
|
+
"ids": ids,
|
|
569
|
+
},
|
|
481
570
|
request_options=request_options,
|
|
482
571
|
)
|
|
483
572
|
try:
|
|
484
573
|
if 200 <= _response.status_code < 300:
|
|
485
|
-
return
|
|
574
|
+
return typing.cast(
|
|
575
|
+
typing.List[FileUpload],
|
|
576
|
+
parse_obj_as(
|
|
577
|
+
type_=typing.List[FileUpload], # type: ignore
|
|
578
|
+
object_=_response.json(),
|
|
579
|
+
),
|
|
580
|
+
)
|
|
486
581
|
_response_json = _response.json()
|
|
487
582
|
except JSONDecodeError:
|
|
488
583
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -490,6 +585,7 @@ class AsyncFilesClient:
|
|
|
490
585
|
|
|
491
586
|
async def delete_many(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
|
|
492
587
|
"""
|
|
588
|
+
|
|
493
589
|
Delete uploaded files for a specific project. These are files that have been uploaded directly to Label Studio.
|
|
494
590
|
|
|
495
591
|
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).
|
|
@@ -508,17 +604,27 @@ class AsyncFilesClient:
|
|
|
508
604
|
|
|
509
605
|
Examples
|
|
510
606
|
--------
|
|
511
|
-
|
|
607
|
+
import asyncio
|
|
608
|
+
|
|
609
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
512
610
|
|
|
513
611
|
client = AsyncLabelStudio(
|
|
514
612
|
api_key="YOUR_API_KEY",
|
|
515
613
|
)
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
)
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
async def main() -> None:
|
|
617
|
+
await client.files.delete_many(
|
|
618
|
+
id=1,
|
|
619
|
+
)
|
|
620
|
+
|
|
621
|
+
|
|
622
|
+
asyncio.run(main())
|
|
519
623
|
"""
|
|
520
624
|
_response = await self._client_wrapper.httpx_client.request(
|
|
521
|
-
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
625
|
+
f"api/projects/{jsonable_encoder(id)}/file-uploads",
|
|
626
|
+
method="DELETE",
|
|
627
|
+
request_options=request_options,
|
|
522
628
|
)
|
|
523
629
|
try:
|
|
524
630
|
if 200 <= _response.status_code < 300:
|
|
@@ -545,17 +651,27 @@ class AsyncFilesClient:
|
|
|
545
651
|
|
|
546
652
|
Examples
|
|
547
653
|
--------
|
|
548
|
-
|
|
654
|
+
import asyncio
|
|
655
|
+
|
|
656
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
549
657
|
|
|
550
658
|
client = AsyncLabelStudio(
|
|
551
659
|
api_key="YOUR_API_KEY",
|
|
552
660
|
)
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
)
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
async def main() -> None:
|
|
664
|
+
await client.files.download(
|
|
665
|
+
filename="filename",
|
|
666
|
+
)
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
asyncio.run(main())
|
|
556
670
|
"""
|
|
557
671
|
_response = await self._client_wrapper.httpx_client.request(
|
|
558
|
-
f"data/upload/{jsonable_encoder(filename)}",
|
|
672
|
+
f"data/upload/{jsonable_encoder(filename)}",
|
|
673
|
+
method="GET",
|
|
674
|
+
request_options=request_options,
|
|
559
675
|
)
|
|
560
676
|
try:
|
|
561
677
|
if 200 <= _response.status_code < 300:
|