Skip to content

Commit 72a6abc

Browse files
Update cookies on successful login and add session/isactive api
1 parent 26d5138 commit 72a6abc

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/thoughtspot_rest_api_v1/tsrestapiv1.py

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@
1111
# We have chosen to make it as simple to understand as possible. There are comments
1212
# and notes written throughout to help the reader understand more.
1313
#
14+
import json
1415
from collections import OrderedDict
1516
from typing import Optional, Dict, List, Union
16-
import json
17+
from copy import copy
1718

1819
import requests
1920

@@ -1286,6 +1287,18 @@ def security_effectivepermissionbulk(self, ids_by_type: Dict, dependent_share: b
12861287
# SESSION Methods
12871288
#
12881289

1290+
def session_isactive(self):
1291+
"""
1292+
Check if the login session is active
1293+
Returns:
1294+
bool: True/False
1295+
"""
1296+
url = f"{self.non_public_base_url}session/isactive"
1297+
headers = copy(self.requests_session.headers)
1298+
headers.update({"Accept": "*/*"})
1299+
response = self.requests_session.get(url, headers=headers)
1300+
return response.ok
1301+
12891302
# Home Pinboard Methods
12901303
def session_homepinboard_post(self, pinboard_guid: str, user_guid: str):
12911304
endpoint = 'session/homepinboard'

0 commit comments

Comments
 (0)