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,924 @@
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.redis_import_storage import RedisImportStorage
12
+ from .types.redis_create_response import RedisCreateResponse
13
+ from .types.redis_update_response import RedisUpdateResponse
14
+
15
+ # this is used as the default value for optional parameters
16
+ OMIT = typing.cast(typing.Any, ...)
17
+
18
+
19
+ class RedisClient:
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[RedisImportStorage]:
26
+ """
27
+ You can connect your Redis database to Label Studio as a source storage or target storage. Use this API request to get a list of all Redis 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[RedisImportStorage]
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.redis.list()
54
+ """
55
+ _response = self._client_wrapper.httpx_client.request(
56
+ "api/storages/redis/", 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[RedisImportStorage], _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
+ regex_filter: typing.Optional[str] = OMIT,
70
+ use_blob_urls: typing.Optional[bool] = OMIT,
71
+ title: typing.Optional[str] = OMIT,
72
+ description: typing.Optional[str] = OMIT,
73
+ project: typing.Optional[int] = OMIT,
74
+ path: typing.Optional[str] = OMIT,
75
+ host: typing.Optional[str] = OMIT,
76
+ port: typing.Optional[str] = OMIT,
77
+ password: typing.Optional[str] = OMIT,
78
+ request_options: typing.Optional[RequestOptions] = None,
79
+ ) -> RedisCreateResponse:
80
+ """
81
+ Create a new source storage connection to a Redis database.
82
+
83
+ For information about the required fields and prerequisites, see [Redis database](https://labelstud.io/guide/storage#Redis-database) in the Label Studio documentation.
84
+
85
+ <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>
86
+
87
+ Parameters
88
+ ----------
89
+ regex_filter : typing.Optional[str]
90
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
91
+
92
+ use_blob_urls : typing.Optional[bool]
93
+ 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.
94
+
95
+ title : typing.Optional[str]
96
+ Storage title
97
+
98
+ description : typing.Optional[str]
99
+ Storage description
100
+
101
+ project : typing.Optional[int]
102
+ Project ID
103
+
104
+ path : typing.Optional[str]
105
+ Storage prefix (optional)
106
+
107
+ host : typing.Optional[str]
108
+ Server Host IP (optional)
109
+
110
+ port : typing.Optional[str]
111
+ Server Port (optional)
112
+
113
+ password : typing.Optional[str]
114
+ Server Password (optional)
115
+
116
+ request_options : typing.Optional[RequestOptions]
117
+ Request-specific configuration.
118
+
119
+ Returns
120
+ -------
121
+ RedisCreateResponse
122
+
123
+
124
+ Examples
125
+ --------
126
+ from label_studio_sdk.client import LabelStudio
127
+
128
+ client = LabelStudio(
129
+ api_key="YOUR_API_KEY",
130
+ )
131
+ client.import_storage.redis.create()
132
+ """
133
+ _response = self._client_wrapper.httpx_client.request(
134
+ "api/storages/redis/",
135
+ method="POST",
136
+ json={
137
+ "regex_filter": regex_filter,
138
+ "use_blob_urls": use_blob_urls,
139
+ "title": title,
140
+ "description": description,
141
+ "project": project,
142
+ "path": path,
143
+ "host": host,
144
+ "port": port,
145
+ "password": password,
146
+ },
147
+ request_options=request_options,
148
+ omit=OMIT,
149
+ )
150
+ if 200 <= _response.status_code < 300:
151
+ return pydantic_v1.parse_obj_as(RedisCreateResponse, _response.json()) # type: ignore
152
+ try:
153
+ _response_json = _response.json()
154
+ except JSONDecodeError:
155
+ raise ApiError(status_code=_response.status_code, body=_response.text)
156
+ raise ApiError(status_code=_response.status_code, body=_response_json)
157
+
158
+ def validate(
159
+ self,
160
+ *,
161
+ id: typing.Optional[int] = OMIT,
162
+ regex_filter: typing.Optional[str] = OMIT,
163
+ use_blob_urls: typing.Optional[bool] = OMIT,
164
+ title: typing.Optional[str] = OMIT,
165
+ description: typing.Optional[str] = OMIT,
166
+ project: typing.Optional[int] = OMIT,
167
+ path: typing.Optional[str] = OMIT,
168
+ host: typing.Optional[str] = OMIT,
169
+ port: typing.Optional[str] = OMIT,
170
+ password: typing.Optional[str] = OMIT,
171
+ request_options: typing.Optional[RequestOptions] = None,
172
+ ) -> None:
173
+ """
174
+ Validate a specific Redis import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
175
+
176
+ Parameters
177
+ ----------
178
+ id : typing.Optional[int]
179
+ Storage ID. If set, storage with specified ID will be updated
180
+
181
+ regex_filter : typing.Optional[str]
182
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
183
+
184
+ use_blob_urls : typing.Optional[bool]
185
+ 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.
186
+
187
+ title : typing.Optional[str]
188
+ Storage title
189
+
190
+ description : typing.Optional[str]
191
+ Storage description
192
+
193
+ project : typing.Optional[int]
194
+ Project ID
195
+
196
+ path : typing.Optional[str]
197
+ Storage prefix (optional)
198
+
199
+ host : typing.Optional[str]
200
+ Server Host IP (optional)
201
+
202
+ port : typing.Optional[str]
203
+ Server Port (optional)
204
+
205
+ password : typing.Optional[str]
206
+ Server Password (optional)
207
+
208
+ request_options : typing.Optional[RequestOptions]
209
+ Request-specific configuration.
210
+
211
+ Returns
212
+ -------
213
+ None
214
+
215
+ Examples
216
+ --------
217
+ from label_studio_sdk.client import LabelStudio
218
+
219
+ client = LabelStudio(
220
+ api_key="YOUR_API_KEY",
221
+ )
222
+ client.import_storage.redis.validate()
223
+ """
224
+ _response = self._client_wrapper.httpx_client.request(
225
+ "api/storages/redis/validate",
226
+ method="POST",
227
+ json={
228
+ "id": id,
229
+ "regex_filter": regex_filter,
230
+ "use_blob_urls": use_blob_urls,
231
+ "title": title,
232
+ "description": description,
233
+ "project": project,
234
+ "path": path,
235
+ "host": host,
236
+ "port": port,
237
+ "password": password,
238
+ },
239
+ request_options=request_options,
240
+ omit=OMIT,
241
+ )
242
+ if 200 <= _response.status_code < 300:
243
+ return
244
+ try:
245
+ _response_json = _response.json()
246
+ except JSONDecodeError:
247
+ raise ApiError(status_code=_response.status_code, body=_response.text)
248
+ raise ApiError(status_code=_response.status_code, body=_response_json)
249
+
250
+ def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> RedisImportStorage:
251
+ """
252
+ Get a specific Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
253
+
254
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
255
+
256
+ Parameters
257
+ ----------
258
+ id : int
259
+ A unique integer value identifying this redis import storage.
260
+
261
+ request_options : typing.Optional[RequestOptions]
262
+ Request-specific configuration.
263
+
264
+ Returns
265
+ -------
266
+ RedisImportStorage
267
+
268
+
269
+ Examples
270
+ --------
271
+ from label_studio_sdk.client import LabelStudio
272
+
273
+ client = LabelStudio(
274
+ api_key="YOUR_API_KEY",
275
+ )
276
+ client.import_storage.redis.get(
277
+ id=1,
278
+ )
279
+ """
280
+ _response = self._client_wrapper.httpx_client.request(
281
+ f"api/storages/redis/{jsonable_encoder(id)}", method="GET", request_options=request_options
282
+ )
283
+ if 200 <= _response.status_code < 300:
284
+ return pydantic_v1.parse_obj_as(RedisImportStorage, _response.json()) # type: ignore
285
+ try:
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
+
291
+ def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
292
+ """
293
+ Delete a specific Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
294
+
295
+ 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.
296
+
297
+ 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.
298
+
299
+ Parameters
300
+ ----------
301
+ id : int
302
+ A unique integer value identifying this redis import storage.
303
+
304
+ request_options : typing.Optional[RequestOptions]
305
+ Request-specific configuration.
306
+
307
+ Returns
308
+ -------
309
+ None
310
+
311
+ Examples
312
+ --------
313
+ from label_studio_sdk.client import LabelStudio
314
+
315
+ client = LabelStudio(
316
+ api_key="YOUR_API_KEY",
317
+ )
318
+ client.import_storage.redis.delete(
319
+ id=1,
320
+ )
321
+ """
322
+ _response = self._client_wrapper.httpx_client.request(
323
+ f"api/storages/redis/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
324
+ )
325
+ if 200 <= _response.status_code < 300:
326
+ return
327
+ try:
328
+ _response_json = _response.json()
329
+ except JSONDecodeError:
330
+ raise ApiError(status_code=_response.status_code, body=_response.text)
331
+ raise ApiError(status_code=_response.status_code, body=_response_json)
332
+
333
+ def update(
334
+ self,
335
+ id: int,
336
+ *,
337
+ regex_filter: typing.Optional[str] = OMIT,
338
+ use_blob_urls: typing.Optional[bool] = OMIT,
339
+ title: typing.Optional[str] = OMIT,
340
+ description: typing.Optional[str] = OMIT,
341
+ project: typing.Optional[int] = OMIT,
342
+ path: typing.Optional[str] = OMIT,
343
+ host: typing.Optional[str] = OMIT,
344
+ port: typing.Optional[str] = OMIT,
345
+ password: typing.Optional[str] = OMIT,
346
+ request_options: typing.Optional[RequestOptions] = None,
347
+ ) -> RedisUpdateResponse:
348
+ """
349
+ Update a specific Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
350
+
351
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
352
+
353
+ Parameters
354
+ ----------
355
+ id : int
356
+ A unique integer value identifying this redis import storage.
357
+
358
+ regex_filter : typing.Optional[str]
359
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
360
+
361
+ use_blob_urls : typing.Optional[bool]
362
+ 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.
363
+
364
+ title : typing.Optional[str]
365
+ Storage title
366
+
367
+ description : typing.Optional[str]
368
+ Storage description
369
+
370
+ project : typing.Optional[int]
371
+ Project ID
372
+
373
+ path : typing.Optional[str]
374
+ Storage prefix (optional)
375
+
376
+ host : typing.Optional[str]
377
+ Server Host IP (optional)
378
+
379
+ port : typing.Optional[str]
380
+ Server Port (optional)
381
+
382
+ password : typing.Optional[str]
383
+ Server Password (optional)
384
+
385
+ request_options : typing.Optional[RequestOptions]
386
+ Request-specific configuration.
387
+
388
+ Returns
389
+ -------
390
+ RedisUpdateResponse
391
+
392
+
393
+ Examples
394
+ --------
395
+ from label_studio_sdk.client import LabelStudio
396
+
397
+ client = LabelStudio(
398
+ api_key="YOUR_API_KEY",
399
+ )
400
+ client.import_storage.redis.update(
401
+ id=1,
402
+ )
403
+ """
404
+ _response = self._client_wrapper.httpx_client.request(
405
+ f"api/storages/redis/{jsonable_encoder(id)}",
406
+ method="PATCH",
407
+ json={
408
+ "regex_filter": regex_filter,
409
+ "use_blob_urls": use_blob_urls,
410
+ "title": title,
411
+ "description": description,
412
+ "project": project,
413
+ "path": path,
414
+ "host": host,
415
+ "port": port,
416
+ "password": password,
417
+ },
418
+ request_options=request_options,
419
+ omit=OMIT,
420
+ )
421
+ if 200 <= _response.status_code < 300:
422
+ return pydantic_v1.parse_obj_as(RedisUpdateResponse, _response.json()) # type: ignore
423
+ try:
424
+ _response_json = _response.json()
425
+ except JSONDecodeError:
426
+ raise ApiError(status_code=_response.status_code, body=_response.text)
427
+ raise ApiError(status_code=_response.status_code, body=_response_json)
428
+
429
+ def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> RedisImportStorage:
430
+ """
431
+ Sync tasks from a Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
432
+
433
+ Sync operations with external databases only go one way. They either create tasks from objects in the database (source/import storage) or push annotations to the output database (export/target storage). Changing something on the database side doesn’t guarantee consistency in results.
434
+
435
+ <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>
436
+
437
+ Parameters
438
+ ----------
439
+ id : int
440
+ Storage ID
441
+
442
+ request_options : typing.Optional[RequestOptions]
443
+ Request-specific configuration.
444
+
445
+ Returns
446
+ -------
447
+ RedisImportStorage
448
+
449
+
450
+ Examples
451
+ --------
452
+ from label_studio_sdk.client import LabelStudio
453
+
454
+ client = LabelStudio(
455
+ api_key="YOUR_API_KEY",
456
+ )
457
+ client.import_storage.redis.sync(
458
+ id=1,
459
+ )
460
+ """
461
+ _response = self._client_wrapper.httpx_client.request(
462
+ f"api/storages/redis/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
463
+ )
464
+ if 200 <= _response.status_code < 300:
465
+ return pydantic_v1.parse_obj_as(RedisImportStorage, _response.json()) # type: ignore
466
+ try:
467
+ _response_json = _response.json()
468
+ except JSONDecodeError:
469
+ raise ApiError(status_code=_response.status_code, body=_response.text)
470
+ raise ApiError(status_code=_response.status_code, body=_response_json)
471
+
472
+
473
+ class AsyncRedisClient:
474
+ def __init__(self, *, client_wrapper: AsyncClientWrapper):
475
+ self._client_wrapper = client_wrapper
476
+
477
+ async def list(
478
+ self, *, project: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None
479
+ ) -> typing.List[RedisImportStorage]:
480
+ """
481
+ You can connect your Redis database to Label Studio as a source storage or target storage. Use this API request to get a list of all Redis import (source) storage connections for a specific project.
482
+
483
+ 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).
484
+
485
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
486
+
487
+ Parameters
488
+ ----------
489
+ project : typing.Optional[int]
490
+ Project ID
491
+
492
+ request_options : typing.Optional[RequestOptions]
493
+ Request-specific configuration.
494
+
495
+ Returns
496
+ -------
497
+ typing.List[RedisImportStorage]
498
+
499
+
500
+ Examples
501
+ --------
502
+ from label_studio_sdk.client import AsyncLabelStudio
503
+
504
+ client = AsyncLabelStudio(
505
+ api_key="YOUR_API_KEY",
506
+ )
507
+ await client.import_storage.redis.list()
508
+ """
509
+ _response = await self._client_wrapper.httpx_client.request(
510
+ "api/storages/redis/", method="GET", params={"project": project}, request_options=request_options
511
+ )
512
+ if 200 <= _response.status_code < 300:
513
+ return pydantic_v1.parse_obj_as(typing.List[RedisImportStorage], _response.json()) # type: ignore
514
+ try:
515
+ _response_json = _response.json()
516
+ except JSONDecodeError:
517
+ raise ApiError(status_code=_response.status_code, body=_response.text)
518
+ raise ApiError(status_code=_response.status_code, body=_response_json)
519
+
520
+ async def create(
521
+ self,
522
+ *,
523
+ regex_filter: typing.Optional[str] = OMIT,
524
+ use_blob_urls: typing.Optional[bool] = OMIT,
525
+ title: typing.Optional[str] = OMIT,
526
+ description: typing.Optional[str] = OMIT,
527
+ project: typing.Optional[int] = OMIT,
528
+ path: typing.Optional[str] = OMIT,
529
+ host: typing.Optional[str] = OMIT,
530
+ port: typing.Optional[str] = OMIT,
531
+ password: typing.Optional[str] = OMIT,
532
+ request_options: typing.Optional[RequestOptions] = None,
533
+ ) -> RedisCreateResponse:
534
+ """
535
+ Create a new source storage connection to a Redis database.
536
+
537
+ For information about the required fields and prerequisites, see [Redis database](https://labelstud.io/guide/storage#Redis-database) in the Label Studio documentation.
538
+
539
+ <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>
540
+
541
+ Parameters
542
+ ----------
543
+ regex_filter : typing.Optional[str]
544
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
545
+
546
+ use_blob_urls : typing.Optional[bool]
547
+ 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.
548
+
549
+ title : typing.Optional[str]
550
+ Storage title
551
+
552
+ description : typing.Optional[str]
553
+ Storage description
554
+
555
+ project : typing.Optional[int]
556
+ Project ID
557
+
558
+ path : typing.Optional[str]
559
+ Storage prefix (optional)
560
+
561
+ host : typing.Optional[str]
562
+ Server Host IP (optional)
563
+
564
+ port : typing.Optional[str]
565
+ Server Port (optional)
566
+
567
+ password : typing.Optional[str]
568
+ Server Password (optional)
569
+
570
+ request_options : typing.Optional[RequestOptions]
571
+ Request-specific configuration.
572
+
573
+ Returns
574
+ -------
575
+ RedisCreateResponse
576
+
577
+
578
+ Examples
579
+ --------
580
+ from label_studio_sdk.client import AsyncLabelStudio
581
+
582
+ client = AsyncLabelStudio(
583
+ api_key="YOUR_API_KEY",
584
+ )
585
+ await client.import_storage.redis.create()
586
+ """
587
+ _response = await self._client_wrapper.httpx_client.request(
588
+ "api/storages/redis/",
589
+ method="POST",
590
+ json={
591
+ "regex_filter": regex_filter,
592
+ "use_blob_urls": use_blob_urls,
593
+ "title": title,
594
+ "description": description,
595
+ "project": project,
596
+ "path": path,
597
+ "host": host,
598
+ "port": port,
599
+ "password": password,
600
+ },
601
+ request_options=request_options,
602
+ omit=OMIT,
603
+ )
604
+ if 200 <= _response.status_code < 300:
605
+ return pydantic_v1.parse_obj_as(RedisCreateResponse, _response.json()) # type: ignore
606
+ try:
607
+ _response_json = _response.json()
608
+ except JSONDecodeError:
609
+ raise ApiError(status_code=_response.status_code, body=_response.text)
610
+ raise ApiError(status_code=_response.status_code, body=_response_json)
611
+
612
+ async def validate(
613
+ self,
614
+ *,
615
+ id: typing.Optional[int] = OMIT,
616
+ regex_filter: typing.Optional[str] = OMIT,
617
+ use_blob_urls: typing.Optional[bool] = OMIT,
618
+ title: typing.Optional[str] = OMIT,
619
+ description: typing.Optional[str] = OMIT,
620
+ project: typing.Optional[int] = OMIT,
621
+ path: typing.Optional[str] = OMIT,
622
+ host: typing.Optional[str] = OMIT,
623
+ port: typing.Optional[str] = OMIT,
624
+ password: typing.Optional[str] = OMIT,
625
+ request_options: typing.Optional[RequestOptions] = None,
626
+ ) -> None:
627
+ """
628
+ Validate a specific Redis import storage connection. This is useful to ensure that the storage configuration settings are correct and operational before attempting to import data.
629
+
630
+ Parameters
631
+ ----------
632
+ id : typing.Optional[int]
633
+ Storage ID. If set, storage with specified ID will be updated
634
+
635
+ regex_filter : typing.Optional[str]
636
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
637
+
638
+ use_blob_urls : typing.Optional[bool]
639
+ 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.
640
+
641
+ title : typing.Optional[str]
642
+ Storage title
643
+
644
+ description : typing.Optional[str]
645
+ Storage description
646
+
647
+ project : typing.Optional[int]
648
+ Project ID
649
+
650
+ path : typing.Optional[str]
651
+ Storage prefix (optional)
652
+
653
+ host : typing.Optional[str]
654
+ Server Host IP (optional)
655
+
656
+ port : typing.Optional[str]
657
+ Server Port (optional)
658
+
659
+ password : typing.Optional[str]
660
+ Server Password (optional)
661
+
662
+ request_options : typing.Optional[RequestOptions]
663
+ Request-specific configuration.
664
+
665
+ Returns
666
+ -------
667
+ None
668
+
669
+ Examples
670
+ --------
671
+ from label_studio_sdk.client import AsyncLabelStudio
672
+
673
+ client = AsyncLabelStudio(
674
+ api_key="YOUR_API_KEY",
675
+ )
676
+ await client.import_storage.redis.validate()
677
+ """
678
+ _response = await self._client_wrapper.httpx_client.request(
679
+ "api/storages/redis/validate",
680
+ method="POST",
681
+ json={
682
+ "id": id,
683
+ "regex_filter": regex_filter,
684
+ "use_blob_urls": use_blob_urls,
685
+ "title": title,
686
+ "description": description,
687
+ "project": project,
688
+ "path": path,
689
+ "host": host,
690
+ "port": port,
691
+ "password": password,
692
+ },
693
+ request_options=request_options,
694
+ omit=OMIT,
695
+ )
696
+ if 200 <= _response.status_code < 300:
697
+ return
698
+ try:
699
+ _response_json = _response.json()
700
+ except JSONDecodeError:
701
+ raise ApiError(status_code=_response.status_code, body=_response.text)
702
+ raise ApiError(status_code=_response.status_code, body=_response_json)
703
+
704
+ async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> RedisImportStorage:
705
+ """
706
+ Get a specific Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
707
+
708
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
709
+
710
+ Parameters
711
+ ----------
712
+ id : int
713
+ A unique integer value identifying this redis import storage.
714
+
715
+ request_options : typing.Optional[RequestOptions]
716
+ Request-specific configuration.
717
+
718
+ Returns
719
+ -------
720
+ RedisImportStorage
721
+
722
+
723
+ Examples
724
+ --------
725
+ from label_studio_sdk.client import AsyncLabelStudio
726
+
727
+ client = AsyncLabelStudio(
728
+ api_key="YOUR_API_KEY",
729
+ )
730
+ await client.import_storage.redis.get(
731
+ id=1,
732
+ )
733
+ """
734
+ _response = await self._client_wrapper.httpx_client.request(
735
+ f"api/storages/redis/{jsonable_encoder(id)}", method="GET", request_options=request_options
736
+ )
737
+ if 200 <= _response.status_code < 300:
738
+ return pydantic_v1.parse_obj_as(RedisImportStorage, _response.json()) # type: ignore
739
+ try:
740
+ _response_json = _response.json()
741
+ except JSONDecodeError:
742
+ raise ApiError(status_code=_response.status_code, body=_response.text)
743
+ raise ApiError(status_code=_response.status_code, body=_response_json)
744
+
745
+ async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
746
+ """
747
+ Delete a specific Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
748
+
749
+ 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.
750
+
751
+ 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.
752
+
753
+ Parameters
754
+ ----------
755
+ id : int
756
+ A unique integer value identifying this redis import storage.
757
+
758
+ request_options : typing.Optional[RequestOptions]
759
+ Request-specific configuration.
760
+
761
+ Returns
762
+ -------
763
+ None
764
+
765
+ Examples
766
+ --------
767
+ from label_studio_sdk.client import AsyncLabelStudio
768
+
769
+ client = AsyncLabelStudio(
770
+ api_key="YOUR_API_KEY",
771
+ )
772
+ await client.import_storage.redis.delete(
773
+ id=1,
774
+ )
775
+ """
776
+ _response = await self._client_wrapper.httpx_client.request(
777
+ f"api/storages/redis/{jsonable_encoder(id)}", method="DELETE", request_options=request_options
778
+ )
779
+ if 200 <= _response.status_code < 300:
780
+ return
781
+ try:
782
+ _response_json = _response.json()
783
+ except JSONDecodeError:
784
+ raise ApiError(status_code=_response.status_code, body=_response.text)
785
+ raise ApiError(status_code=_response.status_code, body=_response_json)
786
+
787
+ async def update(
788
+ self,
789
+ id: int,
790
+ *,
791
+ regex_filter: typing.Optional[str] = OMIT,
792
+ use_blob_urls: typing.Optional[bool] = OMIT,
793
+ title: typing.Optional[str] = OMIT,
794
+ description: typing.Optional[str] = OMIT,
795
+ project: typing.Optional[int] = OMIT,
796
+ path: typing.Optional[str] = OMIT,
797
+ host: typing.Optional[str] = OMIT,
798
+ port: typing.Optional[str] = OMIT,
799
+ password: typing.Optional[str] = OMIT,
800
+ request_options: typing.Optional[RequestOptions] = None,
801
+ ) -> RedisUpdateResponse:
802
+ """
803
+ Update a specific Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
804
+
805
+ For more information about working with external storage, see [Sync data from external storage](https://labelstud.io/guide/storage).
806
+
807
+ Parameters
808
+ ----------
809
+ id : int
810
+ A unique integer value identifying this redis import storage.
811
+
812
+ regex_filter : typing.Optional[str]
813
+ Cloud storage regex for filtering objects. You must specify it otherwise no objects will be imported.
814
+
815
+ use_blob_urls : typing.Optional[bool]
816
+ 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.
817
+
818
+ title : typing.Optional[str]
819
+ Storage title
820
+
821
+ description : typing.Optional[str]
822
+ Storage description
823
+
824
+ project : typing.Optional[int]
825
+ Project ID
826
+
827
+ path : typing.Optional[str]
828
+ Storage prefix (optional)
829
+
830
+ host : typing.Optional[str]
831
+ Server Host IP (optional)
832
+
833
+ port : typing.Optional[str]
834
+ Server Port (optional)
835
+
836
+ password : typing.Optional[str]
837
+ Server Password (optional)
838
+
839
+ request_options : typing.Optional[RequestOptions]
840
+ Request-specific configuration.
841
+
842
+ Returns
843
+ -------
844
+ RedisUpdateResponse
845
+
846
+
847
+ Examples
848
+ --------
849
+ from label_studio_sdk.client import AsyncLabelStudio
850
+
851
+ client = AsyncLabelStudio(
852
+ api_key="YOUR_API_KEY",
853
+ )
854
+ await client.import_storage.redis.update(
855
+ id=1,
856
+ )
857
+ """
858
+ _response = await self._client_wrapper.httpx_client.request(
859
+ f"api/storages/redis/{jsonable_encoder(id)}",
860
+ method="PATCH",
861
+ json={
862
+ "regex_filter": regex_filter,
863
+ "use_blob_urls": use_blob_urls,
864
+ "title": title,
865
+ "description": description,
866
+ "project": project,
867
+ "path": path,
868
+ "host": host,
869
+ "port": port,
870
+ "password": password,
871
+ },
872
+ request_options=request_options,
873
+ omit=OMIT,
874
+ )
875
+ if 200 <= _response.status_code < 300:
876
+ return pydantic_v1.parse_obj_as(RedisUpdateResponse, _response.json()) # type: ignore
877
+ try:
878
+ _response_json = _response.json()
879
+ except JSONDecodeError:
880
+ raise ApiError(status_code=_response.status_code, body=_response.text)
881
+ raise ApiError(status_code=_response.status_code, body=_response_json)
882
+
883
+ async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> RedisImportStorage:
884
+ """
885
+ Sync tasks from a Redis import storage connection. You will need to provide the import storage ID. You can find this using [List import storages](list).
886
+
887
+ Sync operations with external databases only go one way. They either create tasks from objects in the database (source/import storage) or push annotations to the output database (export/target storage). Changing something on the database side doesn’t guarantee consistency in results.
888
+
889
+ <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>
890
+
891
+ Parameters
892
+ ----------
893
+ id : int
894
+ Storage ID
895
+
896
+ request_options : typing.Optional[RequestOptions]
897
+ Request-specific configuration.
898
+
899
+ Returns
900
+ -------
901
+ RedisImportStorage
902
+
903
+
904
+ Examples
905
+ --------
906
+ from label_studio_sdk.client import AsyncLabelStudio
907
+
908
+ client = AsyncLabelStudio(
909
+ api_key="YOUR_API_KEY",
910
+ )
911
+ await client.import_storage.redis.sync(
912
+ id=1,
913
+ )
914
+ """
915
+ _response = await self._client_wrapper.httpx_client.request(
916
+ f"api/storages/redis/{jsonable_encoder(id)}/sync", method="POST", request_options=request_options
917
+ )
918
+ if 200 <= _response.status_code < 300:
919
+ return pydantic_v1.parse_obj_as(RedisImportStorage, _response.json()) # type: ignore
920
+ try:
921
+ _response_json = _response.json()
922
+ except JSONDecodeError:
923
+ raise ApiError(status_code=_response.status_code, body=_response.text)
924
+ raise ApiError(status_code=_response.status_code, body=_response_json)