Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client.projects.exports.download returns None #312

Open
Duoquote opened this issue Sep 16, 2024 · 1 comment
Open

client.projects.exports.download returns None #312

Duoquote opened this issue Sep 16, 2024 · 1 comment

Comments

@Duoquote
Copy link

Duoquote commented Sep 16, 2024

I have the following code:

from label_studio_sdk import ExportCreate, ExportConvert
from label_studio_sdk.client import LabelStudio

LABEL_STUDIO_URL = '...'
API_KEY = '...'
PROJECT_ID = 1

ls = LabelStudio(base_url=LABEL_STUDIO_URL, api_key=API_KEY)

export_task = ls.projects.exports.create(
    id=PROJECT_ID,
    request=ExportCreate()
)

convert_task = ls.projects.exports.convert(
    id=PROJECT_ID,
    export_pk=export_task.id,
    request=ExportConvert(
        export_type="YOLO"
    )
)

data = ls.projects.exports.download(id=PROJECT_ID, export_pk=export_task.id, export_type="YOLO")

And the value of data is None, I am testing it on notebook so I am sure the task is in completed state.

@chewwt
Copy link

chewwt commented Sep 19, 2024

Hi, I have the same problem too.

I think it is because of the following lines in the download function:

if 200 <= _response.status_code < 300:
return

The function should be returning the successful response instead.

My current workaround is to make the download request via the http client directly:

resp = ls._client_wrapper.httpx_client.request(
    f"/api/projects/{PROJECT_ID}/exports/{export_task.id}/download",
    method="GET",
    params={"exportType": "YOLO"},
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants