HumanSignal / HumanSignal/label-studio-sdk
Import Tasks 400 Error Doesn't Include Context from Server
- Dominant language
- Python
- Stars
- 192
- Forks
- 127
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 1
Description
Using `label-studio-sdk` v0.0.28, I tried to run the example code in the SDK tutorial at: https://labelstud.io/guide/sdk.html
But the call to `project.import_tasks` throws an error:
```
Traceback (most recent call last):
File "tools/upload_to_labelstudio.py", line 19, in
project.import_tasks(
File "/lib/python3.10/site-packages/label_studio_sdk/project.py", line 501, in import_tasks
response = self.make_request(
File "/lib/python3.10/site-packages/label_studio_sdk/client.py", line 379, in make_request
response.raise_for_status()
File "/lib/python3.10/site-packages/requests/models.py", line 1021, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:8080/api/projects/4/import?return_task_ids=1
```
```
from label_studio_sdk import Client
LABEL_STUDIO_URL = 'http://localhost:8080'
ls = Client(url=LABEL_STUDIO_URL, api_key=config('LABEL_STUDIO_API_KEY'))
ls.check_connection()
project = ls.start_project(
title='Audio Transcription Project',
label_config='''
</View>
'''
)
project.import_tasks(
[
{'image': 'https://data.heartex.net/open-images/train_0/mini/0045dd96bf73936c.jpg'},
{'image': 'https://data.heartex.net/open-images/train_0/mini/0083d02f6ad18b38.jpg'}
]
)
```
This is because the task key doesn't match the template, but this error is lost
It needs bubbled up to give good context
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.