HumanSignal/label-studio-sdk

Client's `extra_headers` is not propagated when getting a Project

w0ut0 opened this issue · 2 comments

w0ut0 commented

I am adding extra headers to my label-studio Client in order to pass an extra reverse proxy we are running:

from label_studio_sdk import Client
ls = Client(url=LABEL_STUDIO_URL, api_key=API_TOKEN, extra_headers={"X-MY-CUSTOM-AUTH": "123456790"})

The following works fine:

res = ls.make_request("GET", "/api/projects")
# returns projects

Using the SDK fails:

res = ls.get_project(10)
# returns 'unauthenticated', because the header `X-MY-CUSTOM-AUTH` is not provided

It seems that the Project class is initialized without propagating the extra_headers, and thus subsequent calls fail.

Thank you very much for your contribution!