Skip to content

Commit

Permalink
Merge branch 'get-virtual-table-lines' of https://github.com/kavehsha…
Browse files Browse the repository at this point in the history
…hedi/tsp-python-client into get-virtual-table-lines
  • Loading branch information
kavehshahedi committed Jul 15, 2024
2 parents 6eff8c2 + c831f05 commit a576e6e
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions tsp/tsp_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,55 @@ def fetch_virtual_table_lines(self, exp_uuid, output_id, parameters=None):
print(GET_TREE_FAILED.format(response.status_code))
return TspClientResponse(None, response.status_code, response.text)

def fetch_virtual_table_columns(self, exp_uuid, output_id):
'''
Fetch Virtual Table columns, Model extends VirtualTableModel
:param exp_uuid: Experiment UUID
:param output_id: Output ID
:returns: :class: `TspClientResponse <GenericResponse>` object Virtual Table columns response
:rtype: TspClientResponse
'''
api_url = '{0}experiments/{1}/outputs/table/{2}/columns'.format(
self.base_url, exp_uuid, output_id)

response = requests.post(api_url, json={}, headers=headers)

if response.status_code == 200:
return TspClientResponse(GenericResponse(json.loads(response.content.decode('utf-8')),
ModelType.VIRTUAL_TABLE_HEADER),
response.status_code, response.text)
else:
print(GET_TREE_FAILED.format(response.status_code))
return TspClientResponse(None, response.status_code, response.text)

def fetch_virtual_table_lines(self, exp_uuid, output_id, parameters=None):
'''
Fetch Virtual Table lines, Model extends VirtualTableModel
:param exp_uuid: Experiment UUID
:param output_id: Output ID
:param parameters: Query object
:returns: :class: `TspClientResponse <GenericResponse>` object Virtual Table lines response
:rtype: TspClientResponse
'''
api_url = '{0}experiments/{1}/outputs/table/{2}/lines'.format(
self.base_url, exp_uuid, output_id)

params = parameters
if parameters is None:
params = {
TspClient.PARAMETERS_KEY: {}
}

response = requests.post(api_url, json=params, headers=headers)

if response.status_code == 200:
return TspClientResponse(GenericResponse(json.loads(response.content.decode('utf-8')),
ModelType.VIRTUAL_TABLE),
response.status_code, response.text)
else: # pragma: no cover
print(GET_TREE_FAILED.format(response.status_code))
return TspClientResponse(None, response.status_code, response.text)

def fetch_timegraph_tree(self, exp_uuid, output_id, parameters=None):
'''
Fetch Time Graph tree, Model extends TimeGraphEntry
Expand Down

0 comments on commit a576e6e

Please sign in to comment.