How to create a new user and login
jet-c-21 opened this issue · 3 comments
jet-c-21 commented
user_dict = {
'username': 'user1',
'email': 'user1@ichase.com',
'first_name': 'xxx',
'last_name': 'xxx',
'phone': '',
}
# new_user.set_role(UserRole.ANNOTATOR)
created_user = ls.create_user(user_dict)
print(created_user)
how can I login with my created user, I don't see any doc for assigning password for the created user
fdejax90 commented
I tried to create a first user and log in, but complaining about missing attribute cookies
even though it is set by default to None
here
from label_studio_sdk.client import ClientCredentials
credentials = ClientCredentials(email='foo@foo.com', password='foo')
ls = Client(url=LABEL_STUDIO_URL, credentials=credentials)
>>>
File "/Users/.local/share/virtualenvs/ND9qtml7/lib/python3.12/site-packages/label_studio_sdk/client.py", line 91, in __init__
else self.get_api_key(credentials)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/.local/share/virtualenvs/ND9qtml7/lib/python3.12/site-packages/label_studio_sdk/client.py", line 129, in get_api_key
cookies=self.cookies,
^^^^^^^^^^^^
AttributeError: 'Client' object has no attribute 'cookies'
makseq commented
@fdejax90 please try it now with the latest LS SDK (0.0.34) or install it from the github repo.
makseq commented
BTW, In Label Studio Enterprise it's possible to create a user with password using the same API call.