client Package



class str, auth_token: str = '')[source]

Bases: object

Base API class which will be inherited by all the API specific subclasses


If we have an expiration date and the token is expired we make a refresh call then we build a secured request based on the refreshed token. :return: secured request session



class str, auth_token: str = '', login_callback_port: int = 8888)[source]

Bases: object

TVB-BrainX3 client class which expose the whole API. Initializing this class with the correct rest server url is mandatory. The methods for loading datatypes are not intended to be used for datatypes with expandable fields (eg. TimeSeries). Those should be loaded in chunks, because they might be to large to be loaded in memory at once.

add_members_to_project(project_gid: str, new_members_gid: []) None[source]

Add members to the given project. Logged user must be the project administrator :param project_gid: Given project GID :param new_members_gid: List of user which will be project members

create_project(project_name, project_description='')[source]

Create a new project which will be linked to the logged user :param project_name: Project name (mandatory) :param project_description: Project description :return: GID of the new project

fire_simulation(project_gid, session_stored_simulator)[source]

Given a project to execute the operation, and a configuration for the Simulator’s inputs, this will launch the simulation and return its gid


Given a project_gid, this function will return a list of DataTypeDTO instances associated with the current project.


Given an datatype gid, this function returns a dict containing the extra information of the datatype.


Given an operation gid, this function returns a list of DataType instances (subclasses), representing the results of that operation if it has finished and an empty list, if the operation is still running, has failed or simply has no results.


Given an operation gid, this function returns the status of that operation in TVB. The status of operations can be: STATUS_FINISHED = “5-FINISHED” STATUS_PENDING = “4-PENDING” STATUS_STARTED = “3-STARTED” STATUS_CANCELED = “2-CANCELED” STATUS_ERROR = “1-ERROR”


Given a guid, this function will return the available operations for that datatype, as a list of AlgorithmDTO instances

get_operations_in_project(project_gid, page_number)[source]

Given a project_gid and a page number (default page size is 20), this function will return the list of OperationDTO entities


Return all projects for the current logged user.


Return all TVB users

launch_operation(project_gid, algorithm_class, view_model)[source]

This is a more generic method of launching Analyzers. Given a project id, algorithm module, algorithm classname and a view model instance, this function will serialize the view model and will launch the analyzer.


Given a local H5 file location, where previously a valid H5 file has been downloaded from TVB server, load in memory a HasTraits subclass instance (e.g. Connectivity).

load_datatype_with_full_references(datatype_gid: str, download_folder: str) HasTraits[source]

Given a datatype GID, download the entire tree of dependencies and load them in memory. :param datatype_gid: GID of datatype to load :return: datatype object with all references fully loaded

Given a datatype GID, download only the corresponding H5 file and load it in memory. Also, instantiate empty objects as its references only for the purpose to load the GIDs on them. :param datatype_gid: GID of datatype to load :return: datatype object with correct GIDs for references


Logout user by invalidating the keycloak token

static open_browser(url)[source]

Open given URL in a browser. If you want to open the URL in an embedded browser for example you will have to override this method :param url: URL to open

quick_launch_operation(project_gid, algorithm_dto, datatype_gid)[source]
retrieve_datatype(datatype_gid, download_folder)[source]

Given a guid, this function will download locally the H5 full data from the server to the given folder. If encryption was activated, the function will also decrypt the H5 data.


Set the authorization token for API requests. Use this method if you handle the login and token refreshing processes by yourself. :param auth_token: