From 67bea155ab73e4c70fb5e176bedd102b9a6446f2 Mon Sep 17 00:00:00 2001 From: HiroshiKoba Date: Mon, 1 Dec 2025 15:48:55 +0900 Subject: [PATCH 1/2] =?UTF-8?q?=E3=82=B3=E3=83=B3=E3=83=86=E3=83=B3?= =?UTF-8?q?=E3=83=84=E3=81=AE=E3=82=A4=E3=83=B3=E3=83=9D=E3=83=BC=E3=83=88?= =?UTF-8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastlabel/__init__.py | 26 ++++++++++++++++++++++++++ fastlabel/utils/__init__.py | 4 ++++ 2 files changed, 30 insertions(+) diff --git a/fastlabel/__init__.py b/fastlabel/__init__.py index 97cc308..592e597 100644 --- a/fastlabel/__init__.py +++ b/fastlabel/__init__.py @@ -2100,6 +2100,32 @@ def get_appendix_data( return self.api.get_request(endpoint, params=params) + def import_robotics_contents_file( + self, + project: str, + file_path: str, + ) -> list: + """ + Import robotics contents file zip. + project is slug of your project (Required). + file_path is a path to data. Supported extensions are zip (Required). + """ + + if not utils.is_robotics_contents_supported_ext(file_path): + raise FastLabelInvalidException("Supported extensions are zip.", 422) + + endpoint = "contents/imports/robotics-contents/batch" + payload = {"project": project} + signed_url = self.__get_signed_path( + project=project, + file_name=os.path.basename(file_path), + file_type="application/zip", + ) + self.api.upload_zipfile(url=signed_url["url"], file_path=file_path) + payload["fileKey"] = signed_url["name"] + + return self.api.post_request(endpoint, payload=payload) + # Task Update def update_task( diff --git a/fastlabel/utils/__init__.py b/fastlabel/utils/__init__.py index 3b90d73..ae435ae 100644 --- a/fastlabel/utils/__init__.py +++ b/fastlabel/utils/__init__.py @@ -46,6 +46,10 @@ def is_appendix_supported_ext(file_path: str) -> bool: return file_path.lower().endswith((".zip")) +def is_robotics_contents_supported_ext(file_path: str) -> bool: + return file_path.lower().endswith((".zip")) + + def is_pcd_supported_ext(file_path: str) -> bool: # .ply is not yet supported. To support it, modification of the API # needs to be considered as well. From 9980636d2cf83db44434792683307d8f1cea46ba Mon Sep 17 00:00:00 2001 From: HiroshiKoba Date: Mon, 1 Dec 2025 15:49:34 +0900 Subject: [PATCH 2/2] =?UTF-8?q?README=E8=BF=BD=E8=A8=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/README.md b/README.md index 8a39f42..785ef11 100644 --- a/README.md +++ b/README.md @@ -2082,6 +2082,17 @@ task_id = client.create_robotics_task( ) ``` +#### Import Contents + +Import contents zip file + +```python +history = client.import_robotics_contents_file( + project="YOUR_PROJECT_SLUG", + file_path="ZIP_FILE_PATH", +) +``` + ### Common APIs for update and delete and count are same over all tasks.