HumanSignal / HumanSignal/label-studio

Getting a "Client Error" when attempting to retrieve projects from Label-studio

Open
#4,295 3 comments 1 reaction 0 assignees View on GitHub
problem SDK
Dominant language
TypeScript
Stars
28.3k
Forks
3.7k
Avg merge
14h
Merged PRs (30d)
15

Description

I am trying to fetch all the current projects from the Label-studio, here functions `check_connection` & `get_session` work just fine, however, I am getting the following error while fetching the projects using `get_projects`:

#### Code:
```
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
```

#### Error:
```
{'status': 'UP'}

Traceback (most recent call last):
File "/path/to/neuron-de-yolo/label_studio/test.py", line 18, in
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.