Hello Labelbox Community! ![]()
Are you looking to update attachments in your datarows quickly? Weโve got you covered! This quick guide provides a very simple Python script to help you update attachments efficiently in Labelbox (version 3.66.0+).
Easy Steps to Follow:
- Import Labelbox
import labelbox as lb
- Set Up Your API Key

API_KEY = 'YOUR_API_KEY'
client = labelbox.Client(api_key=API_KEY)
- Define Attachment URLs

data_row_id = 'YOUR_DATA_ROW_ID'
update_url = 'CURRENT_ATTACHMENT_URL'
new_attachment_url = 'NEW_ATTACHMENT_URL'
- Update the Attachment

try:
data_row = client.get_data_row(data_row_id)
for attachment in data_row.attachments():
if attachment.attachment_value == update_url:
attachment.update(name= "new_name", value=new_attachment_url)
print(f"Attachment updated: {new_attachment_url}")
break
else:
print("No matching attachment found.")
except labelbox.exceptions.LabelboxError as e:
print(f"Error: {e}")
This script changes the URL of an existing attachment. For other updates, check the Labelbox docs! ![]()
Questions? Drop them below! Weโre here to help you keep your datasets fresh and up-to-date! ![]()
![]()