I can't figure out how to use the export mechanic

I have about 500 photos and all i want to do is either download them so I can get them into gcp or find a way to get them into there without downloading them. I’ve read all the labelbox documents and followed the steps to export using the python scripts but I can’t get it to work and the gcp integration only works to get photos into labelbox not out of it. If someone could just explain how they did it that would be great.

Hi @saxon123 ,

Thanks for your message.
In the Labelbox platform, the “export” functionality retrieves labels and annotations.

The export contains the field row_data that, generally, contains the URL of the asset. If you have access to the URL, you can simply download it with a package like requests for example.

Basic example based on a project export:

Note: For other type of exports, check Export overview

import requests


# Connect to the project
client = lb.Client(LB_API_KEY)
project = client.get_project(PROJECT_ID)

# Export the project
task = project.export_v2()

if task.errors:
  # dr_export is a list of dictionaries (NDJSON)
  dr_export = task.result

  for index, dr in enumerate(dr_export):
    # Retrieve the URL of the data row 
    url = dr["data_row"]["row_data"]

    response = requests.get(url)

    if response.status_code == 200:
      # In this basic example, assets are all saved as PNG images with a forced name 
      with open(f"{index}.png", "wb") as handler:
      print(response.status_code, index, dr["data_row"]["id"])

Let me know if this helps.

Best regards,
Paul N
Labelbox Support