The position of self.cookies = cookies is different
the code from 0.0.32
class Client(object):
def __init__(
self,
url: str = None,
api_key: str = None,
credentials=None,
session=None,
extra_headers: dict = None,
cookies: dict = None,
oidc_token=None,
versions=None,
make_request_raise=True,
):
"""Initialize the client. Do this before using other Label Studio SDK classes and methods in your script.
Parameters
----------
url: str
Label Studio host address.
Example: http://localhost:8080
api_key: str
User token for the API. You can find this on your user account page in Label Studio.
credentials: ClientCredentials
User email and password or api_key.
session: requests.Session()
If None, a new one is created.
extra_headers: dict
Additional headers that will be passed to each http request
cookies: dict
Cookies that will be passed to each http request.
oidc_token: str
Bearer token for proxy authentication - in case the server is behind an authenticating proxy.
versions: dict
Versions of Label Studio components for the connected instance
make_request_raise: bool
If true, make_request will raise exceptions on request errors
"""
if not url:
url = os.getenv('LABEL_STUDIO_URL', LABEL_STUDIO_DEFAULT_URL)
self.url = url.rstrip('/')
self.make_request_raise = make_request_raise
self.session = session or self.get_session()
# set api key or get it using credentials (username and password)
if api_key is None and credentials is None:
api_key = os.getenv('LABEL_STUDIO_API_KEY')
if api_key is not None:
credentials = ClientCredentials(api_key=api_key)
self.api_key = (
credentials.api_key
if credentials.api_key
else self.get_api_key(credentials)
)
# set headers
self.headers = {'Authorization': f'Token {self.api_key}'}
if oidc_token:
self.headers.update({'Proxy-Authorization': f'Bearer {oidc_token}'})
if extra_headers:
self.headers.update(extra_headers)
# set cookies
self.cookies = cookies
# set versions from /version endpoint
self.versions = versions if versions else self.get_versions()
self.is_enterprise = 'label-studio-enterprise-backend' in self.versions
This code from github master branch
class Client(object):
def __init__(
self,
url: str = None,
api_key: str = None,
credentials=None,
session=None,
extra_headers: dict = None,
cookies: dict = None,
oidc_token=None,
versions=None,
make_request_raise=True,
):
"""Initialize the client. Do this before using other Label Studio SDK classes and methods in your script.
Parameters
----------
url: str
Label Studio host address.
Example: http://localhost:8080
api_key: str
User token for the API. You can find this on your user account page in Label Studio.
credentials: ClientCredentials
User email and password or api_key.
session: requests.Session()
If None, a new one is created.
extra_headers: dict
Additional headers that will be passed to each http request
cookies: dict
Cookies that will be passed to each http request.
oidc_token: str
Bearer token for proxy authentication - in case the server is behind an authenticating proxy.
versions: dict
Versions of Label Studio components for the connected instance
make_request_raise: bool
If true, make_request will raise exceptions on request errors
"""
if not url:
url = os.getenv('LABEL_STUDIO_URL', LABEL_STUDIO_DEFAULT_URL)
self.url = url.rstrip('/')
self.make_request_raise = make_request_raise
self.session = session or self.get_session()
# set cookies
self.cookies = cookies
# set api key or get it using credentials (username and password)
if api_key is None and credentials is None:
api_key = os.getenv('LABEL_STUDIO_API_KEY')
if api_key is not None:
credentials = ClientCredentials(api_key=api_key)
self.api_key = (
credentials.api_key
if credentials.api_key
else self.get_api_key(credentials)
)
# set headers
self.headers = {'Authorization': f'Token {self.api_key}'}
if oidc_token:
self.headers.update({'Proxy-Authorization': f'Bearer {oidc_token}'})
if extra_headers:
self.headers.update(extra_headers)
# set versions from /version endpoint
self.versions = versions if versions else self.get_versions()
self.is_enterprise = 'label-studio-enterprise-backend' in self.versions
When will the latest version be released?
0.0.32 has bugs!
for example,
label_studio_sdk.client.py
The position of
self.cookies = cookies
is differentthe code from 0.0.32
This code from github master branch
When will the latest version be released? 0.0.32 has bugs!