Closed colby-vickerson closed 1 year ago
When creating the PR, I noticed that you can pass in a session to the Client
__init__
.
https://github.com/heartexlabs/label-studio-sdk/blob/d6ae9585fc068915a54cd6a6839669b7a4e3f599/label_studio_sdk/client.py#L32.
In the session passed into Client
, you can do the following to setup the cookies:
MAX_RETRIES = 3
HEADERS = {}
session = requests.Session()
session.headers.update(HEADERS)
session.cookies.update(cookies)
session.mount('http://', HTTPAdapter(max_retries=MAX_RETRIES))
session.mount('https://', HTTPAdapter(max_retries=MAX_RETRIES))
Client(url, api_key, session=session)
I think the cookies is a nice addition because you can take advantage of this method that sets up the session:
Merged to master.
I need to pass cookies to the requests session setup in the Client class. The current functionality only supports headers when instantiating the Client class. Update functionality to also allow cookies to be passed into the requests session.