label-studio-sdk 2.0.0__py3-none-any.whl → 2.0.2__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 +24 -0
- label_studio_sdk/actions/client.py +13 -13
- label_studio_sdk/actions/types/actions_list_response_item.py +3 -3
- label_studio_sdk/actions/types/actions_list_response_item_dialog.py +2 -2
- label_studio_sdk/annotations/client.py +441 -441
- label_studio_sdk/base_client.py +4 -0
- label_studio_sdk/billing/__init__.py +2 -0
- label_studio_sdk/billing/client.py +112 -0
- label_studio_sdk/comments/client.py +176 -176
- label_studio_sdk/export_storage/azure/client.py +274 -274
- label_studio_sdk/export_storage/gcs/client.py +263 -263
- label_studio_sdk/export_storage/local/client.py +206 -206
- label_studio_sdk/export_storage/redis/client.py +287 -287
- label_studio_sdk/export_storage/s3/client.py +347 -347
- label_studio_sdk/export_storage/s3s/client.py +678 -678
- label_studio_sdk/import_storage/azure/client.py +357 -357
- label_studio_sdk/import_storage/gcs/client.py +357 -357
- label_studio_sdk/import_storage/local/client.py +206 -206
- label_studio_sdk/import_storage/redis/client.py +309 -309
- label_studio_sdk/import_storage/s3/client.py +452 -452
- label_studio_sdk/import_storage/s3s/client.py +735 -735
- label_studio_sdk/jwt_settings/client.py +10 -10
- label_studio_sdk/ml/client.py +118 -118
- label_studio_sdk/ml/types/ml_list_model_versions_response.py +1 -1
- label_studio_sdk/model_providers/client.py +181 -181
- label_studio_sdk/organizations/members/client.py +348 -2
- label_studio_sdk/predictions/client.py +60 -60
- label_studio_sdk/projects/__init__.py +30 -1
- label_studio_sdk/projects/assignments/__init__.py +33 -0
- label_studio_sdk/projects/assignments/client.py +764 -0
- label_studio_sdk/projects/assignments/types/__init__.py +35 -0
- label_studio_sdk/projects/assignments/types/assignments_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters.py +33 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_conjunction.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item.py +44 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_filter.py +31 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_operator.py +23 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_filters_items_item_value.py +7 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items.py +9 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_excluded.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_selected_items_included.py +29 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_request_type.py +5 -0
- label_studio_sdk/projects/assignments/types/assignments_bulk_assign_response.py +22 -0
- label_studio_sdk/projects/assignments/types/assignments_update_request_type.py +5 -0
- label_studio_sdk/projects/client.py +441 -425
- label_studio_sdk/projects/exports/client.py +55 -55
- label_studio_sdk/projects/exports/types/exports_convert_response.py +1 -1
- label_studio_sdk/projects/stats/types/stats_iaa_response.py +5 -5
- label_studio_sdk/projects/types/projects_import_tasks_response.py +12 -12
- label_studio_sdk/prompts/client.py +211 -211
- label_studio_sdk/prompts/runs/client.py +33 -33
- label_studio_sdk/prompts/versions/client.py +72 -72
- label_studio_sdk/tasks/client.py +174 -174
- label_studio_sdk/types/__init__.py +22 -0
- label_studio_sdk/types/all_roles_project_list.py +98 -98
- label_studio_sdk/types/annotation.py +35 -35
- label_studio_sdk/types/annotation_request.py +27 -27
- label_studio_sdk/types/azure_blob_export_storage.py +29 -29
- label_studio_sdk/types/azure_blob_import_storage.py +33 -33
- label_studio_sdk/types/batch_failed_predictions.py +1 -1
- label_studio_sdk/types/billing_checks.py +39 -0
- label_studio_sdk/types/billing_flags.py +44 -0
- label_studio_sdk/types/billing_info_response.py +22 -0
- label_studio_sdk/types/blueprint_list.py +7 -8
- label_studio_sdk/types/child_filter.py +11 -10
- label_studio_sdk/types/comment.py +15 -15
- label_studio_sdk/types/comment_request.py +7 -8
- label_studio_sdk/types/comment_serializer_with_expanded_user.py +17 -18
- label_studio_sdk/types/converted_format.py +1 -1
- label_studio_sdk/types/converted_format_request.py +1 -1
- label_studio_sdk/types/count_limit.py +22 -0
- label_studio_sdk/types/export.py +8 -8
- label_studio_sdk/types/file_upload.py +3 -2
- label_studio_sdk/types/filter.py +10 -9
- label_studio_sdk/types/filter_group.py +4 -3
- label_studio_sdk/types/gcs_export_storage.py +23 -23
- label_studio_sdk/types/gcs_import_storage.py +27 -27
- label_studio_sdk/types/import_api_request.py +26 -26
- label_studio_sdk/types/inference_run_cost_estimate.py +10 -10
- label_studio_sdk/types/local_files_export_storage.py +23 -23
- label_studio_sdk/types/local_files_import_storage.py +26 -26
- label_studio_sdk/types/lse_annotation_filter_options.py +10 -10
- label_studio_sdk/types/lse_annotation_filter_options_request.py +10 -10
- label_studio_sdk/types/lse_export_create.py +12 -12
- label_studio_sdk/types/lse_fields.py +14 -14
- label_studio_sdk/types/lse_organization.py +17 -17
- label_studio_sdk/types/lse_organization_member_list.py +32 -0
- label_studio_sdk/types/lse_project_create.py +72 -72
- label_studio_sdk/types/lse_project_update.py +89 -89
- label_studio_sdk/types/lse_s3export_storage.py +46 -46
- label_studio_sdk/types/lse_s3export_storage_request.py +43 -43
- label_studio_sdk/types/lse_s3import_storage.py +53 -53
- label_studio_sdk/types/lse_s3import_storage_request.py +49 -49
- label_studio_sdk/types/lse_task.py +49 -49
- label_studio_sdk/types/lse_task_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_filter_options.py +14 -14
- label_studio_sdk/types/lse_task_filter_options_request.py +14 -14
- label_studio_sdk/types/lse_task_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_annotators.py +12 -12
- label_studio_sdk/types/lse_task_serializer_for_annotators_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_annotators_predictions_item.py +5 -5
- label_studio_sdk/types/lse_task_serializer_for_reviewers.py +49 -49
- label_studio_sdk/types/lse_task_serializer_for_reviewers_drafts_item.py +1 -1
- label_studio_sdk/types/lse_task_serializer_for_reviewers_predictions_item.py +5 -5
- label_studio_sdk/types/lse_user.py +13 -13
- label_studio_sdk/types/lse_user_api.py +11 -11
- label_studio_sdk/types/lse_user_organization_member_list.py +48 -0
- label_studio_sdk/types/lseapi_token_create.py +1 -1
- label_studio_sdk/types/lseapi_token_list.py +1 -1
- label_studio_sdk/types/lsejwt_settings.py +5 -5
- label_studio_sdk/types/ml_backend.py +27 -28
- label_studio_sdk/types/model_interface.py +12 -12
- label_studio_sdk/types/model_interface_request.py +7 -8
- label_studio_sdk/types/model_interface_serializer_get.py +13 -13
- label_studio_sdk/types/model_provider_connection.py +34 -34
- label_studio_sdk/types/model_provider_connection_request.py +15 -14
- label_studio_sdk/types/model_run.py +12 -12
- label_studio_sdk/types/organization_billing.py +1 -1
- label_studio_sdk/types/organization_id.py +2 -2
- label_studio_sdk/types/organization_invite.py +1 -1
- label_studio_sdk/types/organization_member.py +8 -9
- label_studio_sdk/types/organization_membership.py +2 -1
- label_studio_sdk/types/paginated_lse_organization_member_list_list.py +23 -0
- label_studio_sdk/types/pause.py +23 -23
- label_studio_sdk/types/prediction.py +21 -21
- label_studio_sdk/types/prediction_request.py +16 -16
- label_studio_sdk/types/project.py +72 -72
- label_studio_sdk/types/project_import.py +21 -21
- label_studio_sdk/types/prompts_status_enum.py +16 -0
- label_studio_sdk/types/redis_export_storage.py +34 -34
- label_studio_sdk/types/redis_import_storage.py +37 -37
- label_studio_sdk/types/refined_prompt_response.py +11 -11
- label_studio_sdk/types/review_settings.py +29 -30
- label_studio_sdk/types/review_settings_request.py +29 -30
- label_studio_sdk/types/role9e7enum.py +5 -0
- label_studio_sdk/types/s3export_storage.py +45 -45
- label_studio_sdk/types/s3import_storage.py +44 -44
- label_studio_sdk/types/selected_items_request.py +1 -1
- label_studio_sdk/types/serialization_options.py +10 -10
- label_studio_sdk/types/serialization_options_request.py +10 -10
- label_studio_sdk/types/task_assignment.py +43 -0
- label_studio_sdk/types/third_party_model_version.py +11 -11
- label_studio_sdk/types/third_party_model_version_request.py +6 -7
- label_studio_sdk/types/type_enum.py +5 -0
- label_studio_sdk/types/user_simple.py +3 -3
- label_studio_sdk/types/user_simple_request.py +1 -1
- label_studio_sdk/types/version_response.py +19 -20
- label_studio_sdk/types/view.py +8 -8
- label_studio_sdk/types/webhook.py +16 -16
- label_studio_sdk/types/webhook_serializer_for_update.py +16 -16
- label_studio_sdk/types/workspace.py +10 -11
- label_studio_sdk/users/client.py +160 -160
- label_studio_sdk/views/client.py +164 -164
- label_studio_sdk/webhooks/client.py +183 -183
- label_studio_sdk/webhooks/types/webhooks_info_response.py +32 -32
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotation_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_annotations_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_label_link_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_project_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_review_updated.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_reviews_deleted.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_created.py +1 -1
- label_studio_sdk/webhooks/types/webhooks_info_response_tasks_deleted.py +1 -1
- label_studio_sdk/workspaces/client.py +40 -40
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/METADATA +73 -25
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/RECORD +175 -146
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/LICENSE +0 -0
- {label_studio_sdk-2.0.0.dist-info → label_studio_sdk-2.0.2.dist-info}/WHEEL +0 -0
|
@@ -79,17 +79,17 @@ class GcsClient:
|
|
|
79
79
|
def create(
|
|
80
80
|
self,
|
|
81
81
|
*,
|
|
82
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
83
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
84
|
-
presign: typing.Optional[bool] = OMIT,
|
|
85
|
-
presign_ttl: typing.Optional[int] = OMIT,
|
|
86
|
-
title: typing.Optional[str] = OMIT,
|
|
87
|
-
description: typing.Optional[str] = OMIT,
|
|
88
|
-
project: typing.Optional[int] = OMIT,
|
|
89
82
|
bucket: typing.Optional[str] = OMIT,
|
|
90
|
-
|
|
83
|
+
description: typing.Optional[str] = OMIT,
|
|
91
84
|
google_application_credentials: typing.Optional[str] = OMIT,
|
|
92
85
|
google_project_id: typing.Optional[str] = OMIT,
|
|
86
|
+
prefix: typing.Optional[str] = OMIT,
|
|
87
|
+
presign: typing.Optional[bool] = OMIT,
|
|
88
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
89
|
+
project: typing.Optional[int] = OMIT,
|
|
90
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
91
|
+
title: typing.Optional[str] = OMIT,
|
|
92
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
93
93
|
request_options: typing.Optional[RequestOptions] = None,
|
|
94
94
|
) -> GcsImportStorage:
|
|
95
95
|
"""
|
|
@@ -97,11 +97,20 @@ class GcsClient:
|
|
|
97
97
|
|
|
98
98
|
Parameters
|
|
99
99
|
----------
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
bucket : typing.Optional[str]
|
|
101
|
+
GCS bucket name
|
|
102
102
|
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
description : typing.Optional[str]
|
|
104
|
+
Storage description
|
|
105
|
+
|
|
106
|
+
google_application_credentials : typing.Optional[str]
|
|
107
|
+
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
108
|
+
|
|
109
|
+
google_project_id : typing.Optional[str]
|
|
110
|
+
Google project ID
|
|
111
|
+
|
|
112
|
+
prefix : typing.Optional[str]
|
|
113
|
+
GCS bucket prefix
|
|
105
114
|
|
|
106
115
|
presign : typing.Optional[bool]
|
|
107
116
|
Presign URLs for direct download
|
|
@@ -109,26 +118,17 @@ class GcsClient:
|
|
|
109
118
|
presign_ttl : typing.Optional[int]
|
|
110
119
|
Presign TTL in minutes
|
|
111
120
|
|
|
112
|
-
title : typing.Optional[str]
|
|
113
|
-
Storage title
|
|
114
|
-
|
|
115
|
-
description : typing.Optional[str]
|
|
116
|
-
Storage description
|
|
117
|
-
|
|
118
121
|
project : typing.Optional[int]
|
|
119
122
|
Project ID
|
|
120
123
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
prefix : typing.Optional[str]
|
|
125
|
-
GCS bucket prefix
|
|
124
|
+
regex_filter : typing.Optional[str]
|
|
125
|
+
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
126
126
|
|
|
127
|
-
|
|
128
|
-
|
|
127
|
+
title : typing.Optional[str]
|
|
128
|
+
Storage title
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
use_blob_urls : typing.Optional[bool]
|
|
131
|
+
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
132
132
|
|
|
133
133
|
request_options : typing.Optional[RequestOptions]
|
|
134
134
|
Request-specific configuration.
|
|
@@ -151,17 +151,17 @@ class GcsClient:
|
|
|
151
151
|
"api/storages/gcs/",
|
|
152
152
|
method="POST",
|
|
153
153
|
json={
|
|
154
|
-
"regex_filter": regex_filter,
|
|
155
|
-
"use_blob_urls": use_blob_urls,
|
|
156
|
-
"presign": presign,
|
|
157
|
-
"presign_ttl": presign_ttl,
|
|
158
|
-
"title": title,
|
|
159
|
-
"description": description,
|
|
160
|
-
"project": project,
|
|
161
154
|
"bucket": bucket,
|
|
162
|
-
"
|
|
155
|
+
"description": description,
|
|
163
156
|
"google_application_credentials": google_application_credentials,
|
|
164
157
|
"google_project_id": google_project_id,
|
|
158
|
+
"prefix": prefix,
|
|
159
|
+
"presign": presign,
|
|
160
|
+
"presign_ttl": presign_ttl,
|
|
161
|
+
"project": project,
|
|
162
|
+
"regex_filter": regex_filter,
|
|
163
|
+
"title": title,
|
|
164
|
+
"use_blob_urls": use_blob_urls,
|
|
165
165
|
},
|
|
166
166
|
headers={
|
|
167
167
|
"content-type": "application/json",
|
|
@@ -183,6 +183,111 @@ class GcsClient:
|
|
|
183
183
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
184
184
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
185
185
|
|
|
186
|
+
def validate(
|
|
187
|
+
self,
|
|
188
|
+
*,
|
|
189
|
+
bucket: typing.Optional[str] = OMIT,
|
|
190
|
+
description: typing.Optional[str] = OMIT,
|
|
191
|
+
google_application_credentials: typing.Optional[str] = OMIT,
|
|
192
|
+
google_project_id: typing.Optional[str] = OMIT,
|
|
193
|
+
id: typing.Optional[int] = OMIT,
|
|
194
|
+
prefix: typing.Optional[str] = OMIT,
|
|
195
|
+
presign: typing.Optional[bool] = OMIT,
|
|
196
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
197
|
+
project: typing.Optional[int] = OMIT,
|
|
198
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
199
|
+
title: typing.Optional[str] = OMIT,
|
|
200
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
201
|
+
request_options: typing.Optional[RequestOptions] = None,
|
|
202
|
+
) -> None:
|
|
203
|
+
"""
|
|
204
|
+
Validate a specific GCS import storage connection.
|
|
205
|
+
|
|
206
|
+
Parameters
|
|
207
|
+
----------
|
|
208
|
+
bucket : typing.Optional[str]
|
|
209
|
+
GCS bucket name
|
|
210
|
+
|
|
211
|
+
description : typing.Optional[str]
|
|
212
|
+
Storage description
|
|
213
|
+
|
|
214
|
+
google_application_credentials : typing.Optional[str]
|
|
215
|
+
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
216
|
+
|
|
217
|
+
google_project_id : typing.Optional[str]
|
|
218
|
+
Google project ID
|
|
219
|
+
|
|
220
|
+
id : typing.Optional[int]
|
|
221
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
222
|
+
|
|
223
|
+
prefix : typing.Optional[str]
|
|
224
|
+
GCS bucket prefix
|
|
225
|
+
|
|
226
|
+
presign : typing.Optional[bool]
|
|
227
|
+
Presign URLs for direct download
|
|
228
|
+
|
|
229
|
+
presign_ttl : typing.Optional[int]
|
|
230
|
+
Presign TTL in minutes
|
|
231
|
+
|
|
232
|
+
project : typing.Optional[int]
|
|
233
|
+
Project ID
|
|
234
|
+
|
|
235
|
+
regex_filter : typing.Optional[str]
|
|
236
|
+
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
237
|
+
|
|
238
|
+
title : typing.Optional[str]
|
|
239
|
+
Storage title
|
|
240
|
+
|
|
241
|
+
use_blob_urls : typing.Optional[bool]
|
|
242
|
+
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
243
|
+
|
|
244
|
+
request_options : typing.Optional[RequestOptions]
|
|
245
|
+
Request-specific configuration.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
None
|
|
250
|
+
|
|
251
|
+
Examples
|
|
252
|
+
--------
|
|
253
|
+
from label_studio_sdk import LabelStudio
|
|
254
|
+
|
|
255
|
+
client = LabelStudio(
|
|
256
|
+
api_key="YOUR_API_KEY",
|
|
257
|
+
)
|
|
258
|
+
client.import_storage.gcs.validate()
|
|
259
|
+
"""
|
|
260
|
+
_response = self._client_wrapper.httpx_client.request(
|
|
261
|
+
"api/storages/gcs/validate",
|
|
262
|
+
method="POST",
|
|
263
|
+
json={
|
|
264
|
+
"bucket": bucket,
|
|
265
|
+
"description": description,
|
|
266
|
+
"google_application_credentials": google_application_credentials,
|
|
267
|
+
"google_project_id": google_project_id,
|
|
268
|
+
"id": id,
|
|
269
|
+
"prefix": prefix,
|
|
270
|
+
"presign": presign,
|
|
271
|
+
"presign_ttl": presign_ttl,
|
|
272
|
+
"project": project,
|
|
273
|
+
"regex_filter": regex_filter,
|
|
274
|
+
"title": title,
|
|
275
|
+
"use_blob_urls": use_blob_urls,
|
|
276
|
+
},
|
|
277
|
+
headers={
|
|
278
|
+
"content-type": "application/json",
|
|
279
|
+
},
|
|
280
|
+
request_options=request_options,
|
|
281
|
+
omit=OMIT,
|
|
282
|
+
)
|
|
283
|
+
try:
|
|
284
|
+
if 200 <= _response.status_code < 300:
|
|
285
|
+
return
|
|
286
|
+
_response_json = _response.json()
|
|
287
|
+
except JSONDecodeError:
|
|
288
|
+
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
289
|
+
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
290
|
+
|
|
186
291
|
def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> GcsImportStorage:
|
|
187
292
|
"""
|
|
188
293
|
Get a specific GCS import storage connection.
|
|
@@ -272,17 +377,17 @@ class GcsClient:
|
|
|
272
377
|
self,
|
|
273
378
|
id: int,
|
|
274
379
|
*,
|
|
275
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
276
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
277
|
-
presign: typing.Optional[bool] = OMIT,
|
|
278
|
-
presign_ttl: typing.Optional[int] = OMIT,
|
|
279
|
-
title: typing.Optional[str] = OMIT,
|
|
280
|
-
description: typing.Optional[str] = OMIT,
|
|
281
|
-
project: typing.Optional[int] = OMIT,
|
|
282
380
|
bucket: typing.Optional[str] = OMIT,
|
|
283
|
-
|
|
381
|
+
description: typing.Optional[str] = OMIT,
|
|
284
382
|
google_application_credentials: typing.Optional[str] = OMIT,
|
|
285
383
|
google_project_id: typing.Optional[str] = OMIT,
|
|
384
|
+
prefix: typing.Optional[str] = OMIT,
|
|
385
|
+
presign: typing.Optional[bool] = OMIT,
|
|
386
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
387
|
+
project: typing.Optional[int] = OMIT,
|
|
388
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
389
|
+
title: typing.Optional[str] = OMIT,
|
|
390
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
286
391
|
request_options: typing.Optional[RequestOptions] = None,
|
|
287
392
|
) -> GcsImportStorage:
|
|
288
393
|
"""
|
|
@@ -292,11 +397,20 @@ class GcsClient:
|
|
|
292
397
|
----------
|
|
293
398
|
id : int
|
|
294
399
|
|
|
295
|
-
|
|
296
|
-
|
|
400
|
+
bucket : typing.Optional[str]
|
|
401
|
+
GCS bucket name
|
|
297
402
|
|
|
298
|
-
|
|
299
|
-
|
|
403
|
+
description : typing.Optional[str]
|
|
404
|
+
Storage description
|
|
405
|
+
|
|
406
|
+
google_application_credentials : typing.Optional[str]
|
|
407
|
+
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
408
|
+
|
|
409
|
+
google_project_id : typing.Optional[str]
|
|
410
|
+
Google project ID
|
|
411
|
+
|
|
412
|
+
prefix : typing.Optional[str]
|
|
413
|
+
GCS bucket prefix
|
|
300
414
|
|
|
301
415
|
presign : typing.Optional[bool]
|
|
302
416
|
Presign URLs for direct download
|
|
@@ -304,26 +418,17 @@ class GcsClient:
|
|
|
304
418
|
presign_ttl : typing.Optional[int]
|
|
305
419
|
Presign TTL in minutes
|
|
306
420
|
|
|
307
|
-
title : typing.Optional[str]
|
|
308
|
-
Storage title
|
|
309
|
-
|
|
310
|
-
description : typing.Optional[str]
|
|
311
|
-
Storage description
|
|
312
|
-
|
|
313
421
|
project : typing.Optional[int]
|
|
314
422
|
Project ID
|
|
315
423
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
prefix : typing.Optional[str]
|
|
320
|
-
GCS bucket prefix
|
|
424
|
+
regex_filter : typing.Optional[str]
|
|
425
|
+
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
321
426
|
|
|
322
|
-
|
|
323
|
-
|
|
427
|
+
title : typing.Optional[str]
|
|
428
|
+
Storage title
|
|
324
429
|
|
|
325
|
-
|
|
326
|
-
|
|
430
|
+
use_blob_urls : typing.Optional[bool]
|
|
431
|
+
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
327
432
|
|
|
328
433
|
request_options : typing.Optional[RequestOptions]
|
|
329
434
|
Request-specific configuration.
|
|
@@ -348,17 +453,17 @@ class GcsClient:
|
|
|
348
453
|
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
349
454
|
method="PATCH",
|
|
350
455
|
json={
|
|
351
|
-
"regex_filter": regex_filter,
|
|
352
|
-
"use_blob_urls": use_blob_urls,
|
|
353
|
-
"presign": presign,
|
|
354
|
-
"presign_ttl": presign_ttl,
|
|
355
|
-
"title": title,
|
|
356
|
-
"description": description,
|
|
357
|
-
"project": project,
|
|
358
456
|
"bucket": bucket,
|
|
359
|
-
"
|
|
457
|
+
"description": description,
|
|
360
458
|
"google_application_credentials": google_application_credentials,
|
|
361
459
|
"google_project_id": google_project_id,
|
|
460
|
+
"prefix": prefix,
|
|
461
|
+
"presign": presign,
|
|
462
|
+
"presign_ttl": presign_ttl,
|
|
463
|
+
"project": project,
|
|
464
|
+
"regex_filter": regex_filter,
|
|
465
|
+
"title": title,
|
|
466
|
+
"use_blob_urls": use_blob_urls,
|
|
362
467
|
},
|
|
363
468
|
headers={
|
|
364
469
|
"content-type": "application/json",
|
|
@@ -427,140 +532,137 @@ class GcsClient:
|
|
|
427
532
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
428
533
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
429
534
|
|
|
430
|
-
|
|
535
|
+
|
|
536
|
+
class AsyncGcsClient:
|
|
537
|
+
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
538
|
+
self._client_wrapper = client_wrapper
|
|
539
|
+
|
|
540
|
+
async def list(
|
|
431
541
|
self,
|
|
432
542
|
*,
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
436
|
-
presign: typing.Optional[bool] = OMIT,
|
|
437
|
-
presign_ttl: typing.Optional[int] = OMIT,
|
|
438
|
-
title: typing.Optional[str] = OMIT,
|
|
439
|
-
description: typing.Optional[str] = OMIT,
|
|
440
|
-
project: typing.Optional[int] = OMIT,
|
|
441
|
-
bucket: typing.Optional[str] = OMIT,
|
|
442
|
-
prefix: typing.Optional[str] = OMIT,
|
|
443
|
-
google_application_credentials: typing.Optional[str] = OMIT,
|
|
444
|
-
google_project_id: typing.Optional[str] = OMIT,
|
|
543
|
+
ordering: typing.Optional[str] = None,
|
|
544
|
+
project: typing.Optional[int] = None,
|
|
445
545
|
request_options: typing.Optional[RequestOptions] = None,
|
|
446
|
-
) ->
|
|
546
|
+
) -> typing.List[GcsImportStorage]:
|
|
447
547
|
"""
|
|
448
|
-
|
|
548
|
+
Get a list of all GCS import storage connections.
|
|
449
549
|
|
|
450
550
|
Parameters
|
|
451
551
|
----------
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
regex_filter : typing.Optional[str]
|
|
456
|
-
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
457
|
-
|
|
458
|
-
use_blob_urls : typing.Optional[bool]
|
|
459
|
-
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
460
|
-
|
|
461
|
-
presign : typing.Optional[bool]
|
|
462
|
-
Presign URLs for direct download
|
|
463
|
-
|
|
464
|
-
presign_ttl : typing.Optional[int]
|
|
465
|
-
Presign TTL in minutes
|
|
466
|
-
|
|
467
|
-
title : typing.Optional[str]
|
|
468
|
-
Storage title
|
|
469
|
-
|
|
470
|
-
description : typing.Optional[str]
|
|
471
|
-
Storage description
|
|
552
|
+
ordering : typing.Optional[str]
|
|
553
|
+
Which field to use when ordering the results.
|
|
472
554
|
|
|
473
555
|
project : typing.Optional[int]
|
|
474
556
|
Project ID
|
|
475
557
|
|
|
476
|
-
bucket : typing.Optional[str]
|
|
477
|
-
GCS bucket name
|
|
478
|
-
|
|
479
|
-
prefix : typing.Optional[str]
|
|
480
|
-
GCS bucket prefix
|
|
481
|
-
|
|
482
|
-
google_application_credentials : typing.Optional[str]
|
|
483
|
-
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
484
|
-
|
|
485
|
-
google_project_id : typing.Optional[str]
|
|
486
|
-
Google project ID
|
|
487
|
-
|
|
488
558
|
request_options : typing.Optional[RequestOptions]
|
|
489
559
|
Request-specific configuration.
|
|
490
560
|
|
|
491
561
|
Returns
|
|
492
562
|
-------
|
|
493
|
-
|
|
563
|
+
typing.List[GcsImportStorage]
|
|
564
|
+
|
|
494
565
|
|
|
495
566
|
Examples
|
|
496
567
|
--------
|
|
497
|
-
|
|
568
|
+
import asyncio
|
|
498
569
|
|
|
499
|
-
|
|
570
|
+
from label_studio_sdk import AsyncLabelStudio
|
|
571
|
+
|
|
572
|
+
client = AsyncLabelStudio(
|
|
500
573
|
api_key="YOUR_API_KEY",
|
|
501
574
|
)
|
|
502
|
-
|
|
575
|
+
|
|
576
|
+
|
|
577
|
+
async def main() -> None:
|
|
578
|
+
await client.import_storage.gcs.list()
|
|
579
|
+
|
|
580
|
+
|
|
581
|
+
asyncio.run(main())
|
|
503
582
|
"""
|
|
504
|
-
_response = self._client_wrapper.httpx_client.request(
|
|
505
|
-
"api/storages/gcs/
|
|
506
|
-
method="
|
|
507
|
-
|
|
508
|
-
"
|
|
509
|
-
"regex_filter": regex_filter,
|
|
510
|
-
"use_blob_urls": use_blob_urls,
|
|
511
|
-
"presign": presign,
|
|
512
|
-
"presign_ttl": presign_ttl,
|
|
513
|
-
"title": title,
|
|
514
|
-
"description": description,
|
|
583
|
+
_response = await self._client_wrapper.httpx_client.request(
|
|
584
|
+
"api/storages/gcs/",
|
|
585
|
+
method="GET",
|
|
586
|
+
params={
|
|
587
|
+
"ordering": ordering,
|
|
515
588
|
"project": project,
|
|
516
|
-
"bucket": bucket,
|
|
517
|
-
"prefix": prefix,
|
|
518
|
-
"google_application_credentials": google_application_credentials,
|
|
519
|
-
"google_project_id": google_project_id,
|
|
520
|
-
},
|
|
521
|
-
headers={
|
|
522
|
-
"content-type": "application/json",
|
|
523
589
|
},
|
|
524
590
|
request_options=request_options,
|
|
525
|
-
omit=OMIT,
|
|
526
591
|
)
|
|
527
592
|
try:
|
|
528
593
|
if 200 <= _response.status_code < 300:
|
|
529
|
-
return
|
|
594
|
+
return typing.cast(
|
|
595
|
+
typing.List[GcsImportStorage],
|
|
596
|
+
construct_type(
|
|
597
|
+
type_=typing.List[GcsImportStorage], # type: ignore
|
|
598
|
+
object_=_response.json(),
|
|
599
|
+
),
|
|
600
|
+
)
|
|
530
601
|
_response_json = _response.json()
|
|
531
602
|
except JSONDecodeError:
|
|
532
603
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
533
604
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
534
605
|
|
|
535
|
-
|
|
536
|
-
class AsyncGcsClient:
|
|
537
|
-
def __init__(self, *, client_wrapper: AsyncClientWrapper):
|
|
538
|
-
self._client_wrapper = client_wrapper
|
|
539
|
-
|
|
540
|
-
async def list(
|
|
606
|
+
async def create(
|
|
541
607
|
self,
|
|
542
608
|
*,
|
|
543
|
-
|
|
544
|
-
|
|
609
|
+
bucket: typing.Optional[str] = OMIT,
|
|
610
|
+
description: typing.Optional[str] = OMIT,
|
|
611
|
+
google_application_credentials: typing.Optional[str] = OMIT,
|
|
612
|
+
google_project_id: typing.Optional[str] = OMIT,
|
|
613
|
+
prefix: typing.Optional[str] = OMIT,
|
|
614
|
+
presign: typing.Optional[bool] = OMIT,
|
|
615
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
616
|
+
project: typing.Optional[int] = OMIT,
|
|
617
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
618
|
+
title: typing.Optional[str] = OMIT,
|
|
619
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
545
620
|
request_options: typing.Optional[RequestOptions] = None,
|
|
546
|
-
) ->
|
|
621
|
+
) -> GcsImportStorage:
|
|
547
622
|
"""
|
|
548
|
-
|
|
623
|
+
Create a new GCS import storage connection.
|
|
549
624
|
|
|
550
625
|
Parameters
|
|
551
626
|
----------
|
|
552
|
-
|
|
553
|
-
|
|
627
|
+
bucket : typing.Optional[str]
|
|
628
|
+
GCS bucket name
|
|
629
|
+
|
|
630
|
+
description : typing.Optional[str]
|
|
631
|
+
Storage description
|
|
632
|
+
|
|
633
|
+
google_application_credentials : typing.Optional[str]
|
|
634
|
+
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
635
|
+
|
|
636
|
+
google_project_id : typing.Optional[str]
|
|
637
|
+
Google project ID
|
|
638
|
+
|
|
639
|
+
prefix : typing.Optional[str]
|
|
640
|
+
GCS bucket prefix
|
|
641
|
+
|
|
642
|
+
presign : typing.Optional[bool]
|
|
643
|
+
Presign URLs for direct download
|
|
644
|
+
|
|
645
|
+
presign_ttl : typing.Optional[int]
|
|
646
|
+
Presign TTL in minutes
|
|
554
647
|
|
|
555
648
|
project : typing.Optional[int]
|
|
556
649
|
Project ID
|
|
557
650
|
|
|
651
|
+
regex_filter : typing.Optional[str]
|
|
652
|
+
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
653
|
+
|
|
654
|
+
title : typing.Optional[str]
|
|
655
|
+
Storage title
|
|
656
|
+
|
|
657
|
+
use_blob_urls : typing.Optional[bool]
|
|
658
|
+
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
659
|
+
|
|
558
660
|
request_options : typing.Optional[RequestOptions]
|
|
559
661
|
Request-specific configuration.
|
|
560
662
|
|
|
561
663
|
Returns
|
|
562
664
|
-------
|
|
563
|
-
|
|
665
|
+
GcsImportStorage
|
|
564
666
|
|
|
565
667
|
|
|
566
668
|
Examples
|
|
@@ -575,26 +677,39 @@ class AsyncGcsClient:
|
|
|
575
677
|
|
|
576
678
|
|
|
577
679
|
async def main() -> None:
|
|
578
|
-
await client.import_storage.gcs.
|
|
680
|
+
await client.import_storage.gcs.create()
|
|
579
681
|
|
|
580
682
|
|
|
581
683
|
asyncio.run(main())
|
|
582
684
|
"""
|
|
583
685
|
_response = await self._client_wrapper.httpx_client.request(
|
|
584
686
|
"api/storages/gcs/",
|
|
585
|
-
method="
|
|
586
|
-
|
|
587
|
-
"
|
|
687
|
+
method="POST",
|
|
688
|
+
json={
|
|
689
|
+
"bucket": bucket,
|
|
690
|
+
"description": description,
|
|
691
|
+
"google_application_credentials": google_application_credentials,
|
|
692
|
+
"google_project_id": google_project_id,
|
|
693
|
+
"prefix": prefix,
|
|
694
|
+
"presign": presign,
|
|
695
|
+
"presign_ttl": presign_ttl,
|
|
588
696
|
"project": project,
|
|
697
|
+
"regex_filter": regex_filter,
|
|
698
|
+
"title": title,
|
|
699
|
+
"use_blob_urls": use_blob_urls,
|
|
700
|
+
},
|
|
701
|
+
headers={
|
|
702
|
+
"content-type": "application/json",
|
|
589
703
|
},
|
|
590
704
|
request_options=request_options,
|
|
705
|
+
omit=OMIT,
|
|
591
706
|
)
|
|
592
707
|
try:
|
|
593
708
|
if 200 <= _response.status_code < 300:
|
|
594
709
|
return typing.cast(
|
|
595
|
-
|
|
710
|
+
GcsImportStorage,
|
|
596
711
|
construct_type(
|
|
597
|
-
type_=
|
|
712
|
+
type_=GcsImportStorage, # type: ignore
|
|
598
713
|
object_=_response.json(),
|
|
599
714
|
),
|
|
600
715
|
)
|
|
@@ -603,32 +718,45 @@ class AsyncGcsClient:
|
|
|
603
718
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
604
719
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
605
720
|
|
|
606
|
-
async def
|
|
721
|
+
async def validate(
|
|
607
722
|
self,
|
|
608
723
|
*,
|
|
609
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
610
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
611
|
-
presign: typing.Optional[bool] = OMIT,
|
|
612
|
-
presign_ttl: typing.Optional[int] = OMIT,
|
|
613
|
-
title: typing.Optional[str] = OMIT,
|
|
614
|
-
description: typing.Optional[str] = OMIT,
|
|
615
|
-
project: typing.Optional[int] = OMIT,
|
|
616
724
|
bucket: typing.Optional[str] = OMIT,
|
|
617
|
-
|
|
725
|
+
description: typing.Optional[str] = OMIT,
|
|
618
726
|
google_application_credentials: typing.Optional[str] = OMIT,
|
|
619
727
|
google_project_id: typing.Optional[str] = OMIT,
|
|
728
|
+
id: typing.Optional[int] = OMIT,
|
|
729
|
+
prefix: typing.Optional[str] = OMIT,
|
|
730
|
+
presign: typing.Optional[bool] = OMIT,
|
|
731
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
732
|
+
project: typing.Optional[int] = OMIT,
|
|
733
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
734
|
+
title: typing.Optional[str] = OMIT,
|
|
735
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
620
736
|
request_options: typing.Optional[RequestOptions] = None,
|
|
621
|
-
) ->
|
|
737
|
+
) -> None:
|
|
622
738
|
"""
|
|
623
|
-
|
|
739
|
+
Validate a specific GCS import storage connection.
|
|
624
740
|
|
|
625
741
|
Parameters
|
|
626
742
|
----------
|
|
627
|
-
|
|
628
|
-
|
|
743
|
+
bucket : typing.Optional[str]
|
|
744
|
+
GCS bucket name
|
|
629
745
|
|
|
630
|
-
|
|
631
|
-
|
|
746
|
+
description : typing.Optional[str]
|
|
747
|
+
Storage description
|
|
748
|
+
|
|
749
|
+
google_application_credentials : typing.Optional[str]
|
|
750
|
+
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
751
|
+
|
|
752
|
+
google_project_id : typing.Optional[str]
|
|
753
|
+
Google project ID
|
|
754
|
+
|
|
755
|
+
id : typing.Optional[int]
|
|
756
|
+
Storage ID. If set, storage with specified ID will be updated
|
|
757
|
+
|
|
758
|
+
prefix : typing.Optional[str]
|
|
759
|
+
GCS bucket prefix
|
|
632
760
|
|
|
633
761
|
presign : typing.Optional[bool]
|
|
634
762
|
Presign URLs for direct download
|
|
@@ -636,34 +764,24 @@ class AsyncGcsClient:
|
|
|
636
764
|
presign_ttl : typing.Optional[int]
|
|
637
765
|
Presign TTL in minutes
|
|
638
766
|
|
|
639
|
-
title : typing.Optional[str]
|
|
640
|
-
Storage title
|
|
641
|
-
|
|
642
|
-
description : typing.Optional[str]
|
|
643
|
-
Storage description
|
|
644
|
-
|
|
645
767
|
project : typing.Optional[int]
|
|
646
768
|
Project ID
|
|
647
769
|
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
prefix : typing.Optional[str]
|
|
652
|
-
GCS bucket prefix
|
|
770
|
+
regex_filter : typing.Optional[str]
|
|
771
|
+
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
653
772
|
|
|
654
|
-
|
|
655
|
-
|
|
773
|
+
title : typing.Optional[str]
|
|
774
|
+
Storage title
|
|
656
775
|
|
|
657
|
-
|
|
658
|
-
|
|
776
|
+
use_blob_urls : typing.Optional[bool]
|
|
777
|
+
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
659
778
|
|
|
660
779
|
request_options : typing.Optional[RequestOptions]
|
|
661
780
|
Request-specific configuration.
|
|
662
781
|
|
|
663
782
|
Returns
|
|
664
783
|
-------
|
|
665
|
-
|
|
666
|
-
|
|
784
|
+
None
|
|
667
785
|
|
|
668
786
|
Examples
|
|
669
787
|
--------
|
|
@@ -677,26 +795,27 @@ class AsyncGcsClient:
|
|
|
677
795
|
|
|
678
796
|
|
|
679
797
|
async def main() -> None:
|
|
680
|
-
await client.import_storage.gcs.
|
|
798
|
+
await client.import_storage.gcs.validate()
|
|
681
799
|
|
|
682
800
|
|
|
683
801
|
asyncio.run(main())
|
|
684
802
|
"""
|
|
685
803
|
_response = await self._client_wrapper.httpx_client.request(
|
|
686
|
-
"api/storages/gcs/",
|
|
804
|
+
"api/storages/gcs/validate",
|
|
687
805
|
method="POST",
|
|
688
806
|
json={
|
|
689
|
-
"regex_filter": regex_filter,
|
|
690
|
-
"use_blob_urls": use_blob_urls,
|
|
691
|
-
"presign": presign,
|
|
692
|
-
"presign_ttl": presign_ttl,
|
|
693
|
-
"title": title,
|
|
694
|
-
"description": description,
|
|
695
|
-
"project": project,
|
|
696
807
|
"bucket": bucket,
|
|
697
|
-
"
|
|
808
|
+
"description": description,
|
|
698
809
|
"google_application_credentials": google_application_credentials,
|
|
699
810
|
"google_project_id": google_project_id,
|
|
811
|
+
"id": id,
|
|
812
|
+
"prefix": prefix,
|
|
813
|
+
"presign": presign,
|
|
814
|
+
"presign_ttl": presign_ttl,
|
|
815
|
+
"project": project,
|
|
816
|
+
"regex_filter": regex_filter,
|
|
817
|
+
"title": title,
|
|
818
|
+
"use_blob_urls": use_blob_urls,
|
|
700
819
|
},
|
|
701
820
|
headers={
|
|
702
821
|
"content-type": "application/json",
|
|
@@ -706,13 +825,7 @@ class AsyncGcsClient:
|
|
|
706
825
|
)
|
|
707
826
|
try:
|
|
708
827
|
if 200 <= _response.status_code < 300:
|
|
709
|
-
return
|
|
710
|
-
GcsImportStorage,
|
|
711
|
-
construct_type(
|
|
712
|
-
type_=GcsImportStorage, # type: ignore
|
|
713
|
-
object_=_response.json(),
|
|
714
|
-
),
|
|
715
|
-
)
|
|
828
|
+
return
|
|
716
829
|
_response_json = _response.json()
|
|
717
830
|
except JSONDecodeError:
|
|
718
831
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
@@ -823,17 +936,17 @@ class AsyncGcsClient:
|
|
|
823
936
|
self,
|
|
824
937
|
id: int,
|
|
825
938
|
*,
|
|
826
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
827
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
828
|
-
presign: typing.Optional[bool] = OMIT,
|
|
829
|
-
presign_ttl: typing.Optional[int] = OMIT,
|
|
830
|
-
title: typing.Optional[str] = OMIT,
|
|
831
|
-
description: typing.Optional[str] = OMIT,
|
|
832
|
-
project: typing.Optional[int] = OMIT,
|
|
833
939
|
bucket: typing.Optional[str] = OMIT,
|
|
834
|
-
|
|
940
|
+
description: typing.Optional[str] = OMIT,
|
|
835
941
|
google_application_credentials: typing.Optional[str] = OMIT,
|
|
836
942
|
google_project_id: typing.Optional[str] = OMIT,
|
|
943
|
+
prefix: typing.Optional[str] = OMIT,
|
|
944
|
+
presign: typing.Optional[bool] = OMIT,
|
|
945
|
+
presign_ttl: typing.Optional[int] = OMIT,
|
|
946
|
+
project: typing.Optional[int] = OMIT,
|
|
947
|
+
regex_filter: typing.Optional[str] = OMIT,
|
|
948
|
+
title: typing.Optional[str] = OMIT,
|
|
949
|
+
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
837
950
|
request_options: typing.Optional[RequestOptions] = None,
|
|
838
951
|
) -> GcsImportStorage:
|
|
839
952
|
"""
|
|
@@ -843,11 +956,20 @@ class AsyncGcsClient:
|
|
|
843
956
|
----------
|
|
844
957
|
id : int
|
|
845
958
|
|
|
846
|
-
|
|
847
|
-
|
|
959
|
+
bucket : typing.Optional[str]
|
|
960
|
+
GCS bucket name
|
|
848
961
|
|
|
849
|
-
|
|
850
|
-
|
|
962
|
+
description : typing.Optional[str]
|
|
963
|
+
Storage description
|
|
964
|
+
|
|
965
|
+
google_application_credentials : typing.Optional[str]
|
|
966
|
+
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
967
|
+
|
|
968
|
+
google_project_id : typing.Optional[str]
|
|
969
|
+
Google project ID
|
|
970
|
+
|
|
971
|
+
prefix : typing.Optional[str]
|
|
972
|
+
GCS bucket prefix
|
|
851
973
|
|
|
852
974
|
presign : typing.Optional[bool]
|
|
853
975
|
Presign URLs for direct download
|
|
@@ -855,26 +977,17 @@ class AsyncGcsClient:
|
|
|
855
977
|
presign_ttl : typing.Optional[int]
|
|
856
978
|
Presign TTL in minutes
|
|
857
979
|
|
|
858
|
-
title : typing.Optional[str]
|
|
859
|
-
Storage title
|
|
860
|
-
|
|
861
|
-
description : typing.Optional[str]
|
|
862
|
-
Storage description
|
|
863
|
-
|
|
864
980
|
project : typing.Optional[int]
|
|
865
981
|
Project ID
|
|
866
982
|
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
prefix : typing.Optional[str]
|
|
871
|
-
GCS bucket prefix
|
|
983
|
+
regex_filter : typing.Optional[str]
|
|
984
|
+
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
872
985
|
|
|
873
|
-
|
|
874
|
-
|
|
986
|
+
title : typing.Optional[str]
|
|
987
|
+
Storage title
|
|
875
988
|
|
|
876
|
-
|
|
877
|
-
|
|
989
|
+
use_blob_urls : typing.Optional[bool]
|
|
990
|
+
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
878
991
|
|
|
879
992
|
request_options : typing.Optional[RequestOptions]
|
|
880
993
|
Request-specific configuration.
|
|
@@ -907,17 +1020,17 @@ class AsyncGcsClient:
|
|
|
907
1020
|
f"api/storages/gcs/{jsonable_encoder(id)}",
|
|
908
1021
|
method="PATCH",
|
|
909
1022
|
json={
|
|
910
|
-
"regex_filter": regex_filter,
|
|
911
|
-
"use_blob_urls": use_blob_urls,
|
|
912
|
-
"presign": presign,
|
|
913
|
-
"presign_ttl": presign_ttl,
|
|
914
|
-
"title": title,
|
|
915
|
-
"description": description,
|
|
916
|
-
"project": project,
|
|
917
1023
|
"bucket": bucket,
|
|
918
|
-
"
|
|
1024
|
+
"description": description,
|
|
919
1025
|
"google_application_credentials": google_application_credentials,
|
|
920
1026
|
"google_project_id": google_project_id,
|
|
1027
|
+
"prefix": prefix,
|
|
1028
|
+
"presign": presign,
|
|
1029
|
+
"presign_ttl": presign_ttl,
|
|
1030
|
+
"project": project,
|
|
1031
|
+
"regex_filter": regex_filter,
|
|
1032
|
+
"title": title,
|
|
1033
|
+
"use_blob_urls": use_blob_urls,
|
|
921
1034
|
},
|
|
922
1035
|
headers={
|
|
923
1036
|
"content-type": "application/json",
|
|
@@ -993,116 +1106,3 @@ class AsyncGcsClient:
|
|
|
993
1106
|
except JSONDecodeError:
|
|
994
1107
|
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
995
1108
|
raise ApiError(status_code=_response.status_code, body=_response_json)
|
|
996
|
-
|
|
997
|
-
async def validate(
|
|
998
|
-
self,
|
|
999
|
-
*,
|
|
1000
|
-
id: typing.Optional[int] = OMIT,
|
|
1001
|
-
regex_filter: typing.Optional[str] = OMIT,
|
|
1002
|
-
use_blob_urls: typing.Optional[bool] = OMIT,
|
|
1003
|
-
presign: typing.Optional[bool] = OMIT,
|
|
1004
|
-
presign_ttl: typing.Optional[int] = OMIT,
|
|
1005
|
-
title: typing.Optional[str] = OMIT,
|
|
1006
|
-
description: typing.Optional[str] = OMIT,
|
|
1007
|
-
project: typing.Optional[int] = OMIT,
|
|
1008
|
-
bucket: typing.Optional[str] = OMIT,
|
|
1009
|
-
prefix: typing.Optional[str] = OMIT,
|
|
1010
|
-
google_application_credentials: typing.Optional[str] = OMIT,
|
|
1011
|
-
google_project_id: typing.Optional[str] = OMIT,
|
|
1012
|
-
request_options: typing.Optional[RequestOptions] = None,
|
|
1013
|
-
) -> None:
|
|
1014
|
-
"""
|
|
1015
|
-
Validate a specific GCS import storage connection.
|
|
1016
|
-
|
|
1017
|
-
Parameters
|
|
1018
|
-
----------
|
|
1019
|
-
id : typing.Optional[int]
|
|
1020
|
-
Storage ID. If set, storage with specified ID will be updated
|
|
1021
|
-
|
|
1022
|
-
regex_filter : typing.Optional[str]
|
|
1023
|
-
Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
|
|
1024
|
-
|
|
1025
|
-
use_blob_urls : typing.Optional[bool]
|
|
1026
|
-
Interpret objects as BLOBs and generate URLs. For example, if your bucket contains images, you can use this option to generate URLs for these images. If set to False, it will read the content of the file and load it into Label Studio.
|
|
1027
|
-
|
|
1028
|
-
presign : typing.Optional[bool]
|
|
1029
|
-
Presign URLs for direct download
|
|
1030
|
-
|
|
1031
|
-
presign_ttl : typing.Optional[int]
|
|
1032
|
-
Presign TTL in minutes
|
|
1033
|
-
|
|
1034
|
-
title : typing.Optional[str]
|
|
1035
|
-
Storage title
|
|
1036
|
-
|
|
1037
|
-
description : typing.Optional[str]
|
|
1038
|
-
Storage description
|
|
1039
|
-
|
|
1040
|
-
project : typing.Optional[int]
|
|
1041
|
-
Project ID
|
|
1042
|
-
|
|
1043
|
-
bucket : typing.Optional[str]
|
|
1044
|
-
GCS bucket name
|
|
1045
|
-
|
|
1046
|
-
prefix : typing.Optional[str]
|
|
1047
|
-
GCS bucket prefix
|
|
1048
|
-
|
|
1049
|
-
google_application_credentials : typing.Optional[str]
|
|
1050
|
-
The content of GOOGLE_APPLICATION_CREDENTIALS json file. Check official Google Cloud Authentication documentation for more details.
|
|
1051
|
-
|
|
1052
|
-
google_project_id : typing.Optional[str]
|
|
1053
|
-
Google project ID
|
|
1054
|
-
|
|
1055
|
-
request_options : typing.Optional[RequestOptions]
|
|
1056
|
-
Request-specific configuration.
|
|
1057
|
-
|
|
1058
|
-
Returns
|
|
1059
|
-
-------
|
|
1060
|
-
None
|
|
1061
|
-
|
|
1062
|
-
Examples
|
|
1063
|
-
--------
|
|
1064
|
-
import asyncio
|
|
1065
|
-
|
|
1066
|
-
from label_studio_sdk import AsyncLabelStudio
|
|
1067
|
-
|
|
1068
|
-
client = AsyncLabelStudio(
|
|
1069
|
-
api_key="YOUR_API_KEY",
|
|
1070
|
-
)
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
async def main() -> None:
|
|
1074
|
-
await client.import_storage.gcs.validate()
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
asyncio.run(main())
|
|
1078
|
-
"""
|
|
1079
|
-
_response = await self._client_wrapper.httpx_client.request(
|
|
1080
|
-
"api/storages/gcs/validate",
|
|
1081
|
-
method="POST",
|
|
1082
|
-
json={
|
|
1083
|
-
"id": id,
|
|
1084
|
-
"regex_filter": regex_filter,
|
|
1085
|
-
"use_blob_urls": use_blob_urls,
|
|
1086
|
-
"presign": presign,
|
|
1087
|
-
"presign_ttl": presign_ttl,
|
|
1088
|
-
"title": title,
|
|
1089
|
-
"description": description,
|
|
1090
|
-
"project": project,
|
|
1091
|
-
"bucket": bucket,
|
|
1092
|
-
"prefix": prefix,
|
|
1093
|
-
"google_application_credentials": google_application_credentials,
|
|
1094
|
-
"google_project_id": google_project_id,
|
|
1095
|
-
},
|
|
1096
|
-
headers={
|
|
1097
|
-
"content-type": "application/json",
|
|
1098
|
-
},
|
|
1099
|
-
request_options=request_options,
|
|
1100
|
-
omit=OMIT,
|
|
1101
|
-
)
|
|
1102
|
-
try:
|
|
1103
|
-
if 200 <= _response.status_code < 300:
|
|
1104
|
-
return
|
|
1105
|
-
_response_json = _response.json()
|
|
1106
|
-
except JSONDecodeError:
|
|
1107
|
-
raise ApiError(status_code=_response.status_code, body=_response.text)
|
|
1108
|
-
raise ApiError(status_code=_response.status_code, body=_response_json)
|