HumanSignal / label-studio-sdk

Label Studio SDK
https://api.labelstud.io
77 stars 50 forks source link

Task lists produce annotations with None #237

Open matnel opened 2 weeks ago

matnel commented 2 weeks ago
tasks = client.tasks.list(project="1")

for task in tasks:
    print( task.data['username'] )
    print( task.annotations )

when running this code, task.annotations is printed as None, but with the following workaround I am able to get the annotations:

tasks = client.tasks.list(project="1")

for task in tasks:
    print( task.data['username'] )
    annotations = client._client_wrapper.httpx_client.request(f"api/tasks/{task.id}/annotations/", method="GET").json()
    print( annotations )

Looking at the code, most likely I should have defined fields = "all" on the client.tasks.list for them not to be None, but this is not the specified in short the documentation. If I could choose, I would instead change the default of client.tasks.list as fields ="all" to simplify the API use.