client Package

client_decorators

tvb.interfaces.rest.client.client_decorators.handle_response(func)[source]

main_api

class tvb.interfaces.rest.client.main_api.MainApi(server_url: str, auth_token: str = '')[source]

Bases: object

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

build_request_url(url)[source]
secured_request()[source]

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

update_tokens(response)[source]

tvb_client

class tvb.interfaces.rest.client.tvb_client.TVBClient(server_url: 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

browser_login()[source]
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

get_data_in_project(project_gid)[source]

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

get_extra_info(datatype_gid)[source]

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

get_operation_results(operation_gid)[source]

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.

get_operation_status(operation_gid)[source]

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”

get_operations_for_datatype(datatype_gid)[source]

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

get_project_list()[source]

Return all projects for the current logged user.

get_users(page=1)[source]

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.

load_datatype_from_file(datatype_path)[source]

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()[source]

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.

update_auth_token(auth_token)[source]

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

Subpackages