User

A developer guide for managing team members via the Python SDK.

Client

import labelbox as lb
client = lb.Client(api_key="<YOUR_API_KEY>")

Get the current user

user = client.get_user()

Methods

Update an organization role

# get the available roles
roles = client.get_roles()

# update the role (in this case, the user is granted labeler permissions)
user_to_update.update_org_role(roles["LABELER"])

Upsert a project-based role

# get the available roles
roles = client.get_roles()

# get the project
project = client.get_project("<project_id>")

# update the project-based role (in this case, the user is granted reviewer permissions)
user_to_update.upsert_project_role(
  project=project,
  role=roles["REVIEWER"]
)

Remove from a project

# get the project
project = client.get_project("<project_id>")

# remove from the project
user_to_remove.remove_from_project(project)

Attributes

Get the basics

# name (str)
user.name

# nickname (str)
user.nickname

# email (str)
user.email

# created at (datetime)
user.created_at

# updated at (datetime)
user.updated_at

# role (relationship to OrgRole object)
role = user.org_role()

# organization (relationship to Organization object)
organization = user.organization()

Get the projects

# get the projects (relationship to Project objects)
projects = user.projects()

# inspect one project
next(projects)

# inspect all projects
for project in projects:
  print(project)

# for ease of use, you can convert the paginated collection to a list
list(projects)

Get the created tasks

# get the tasks (relationship to Task objects)
tasks = user.created_tasks()

# inspect one project
next(tasks)

# inspect all projects
for task in tasks:
  print(task)

# for ease of use, you can convert the paginated collection to a list
list(tasks)