label-studio-sdk 0.0.34__py3-none-any.whl → 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of label-studio-sdk might be problematic. Click here for more details.

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