Получение «Ошибки клиента» при попытке получить проекты из Label-studio.

Пытаюсь получить все текущие проекты из Label-студии, здесь функцииcheck_connection&get_sessionработает нормально, однако я получаю следующую ошибку при загрузке проектов с помощьюget_projects:

Код:

      from label_studio_sdk import Client

LABEL_STUDIO_URL = 'http://xx.xxx.xx.xxx:xxxx'
API_KEY = 'a6eecde17b14b768085a67a6657c44fac5e0244d'

ls = Client(url=LABEL_STUDIO_URL, api_key=API_KEY)
print(ls.check_connection())  # WORKS
print(ls.get_session())  # WORKS

print(ls.get_projects())  # DOES NOT WORK

Ошибка:

      {'status': 'UP'}
<requests.sessions.Session object at 0x7f85f818a8b0>


Traceback (most recent call last):
  File "/path/to/neuron-de-yolo/label_studio/test.py", line 18, in <module>
    print(ls.get_projects())
  File "/opt/anaconda3/lib/python3.9/site-packages/label_studio_sdk/client.py", line 143, in get_projects
    return self.list_projects()
  File "/opt/anaconda3/lib/python3.9/site-packages/label_studio_sdk/client.py", line 181, in list_projects
    response = self.make_request(
  File "/opt/anaconda3/lib/python3.9/site-packages/label_studio_sdk/client.py", line 374, in make_request
    response.raise_for_status()
  File "/opt/anaconda3/lib/python3.9/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: http://xx.xxx.xx.xxx:xxxx/api/projects?page_size=10000000

0 ответов

Другие вопросы по тегам