Python client
A Python client to interact with the vantage6 server
It is assumed you installed the vantage6-client. The Python client aims to completely cover the vantage6-server API functionality.
We only show a few examples here. The methods in the library are all documented in their docstring, you can view them using help(...) , e.g. help(client.user.create) will show you the parameters needed to create a new user.
The following code will initialize the Python client and log in to the server.
1
from vantage6.client import Client
2
3
server_url = 'https://where.server.is'
4
server_port = <port number>
5
server_api_path = '/path/to/api'
6
username = 'user'
7
password = 'password'
8
9
client = Client(server_url, server_port, server_api_path, verbose=True)
10
client.authenticate(username, password)
11
12
# this needs to match the collaboration encryption setting. If you do use
13
# encryption, you specify the private key file path here
14
client.setup_encryption(None)
Copied!
We recommend setting verbose=True when initializing the client as this will print much more info.
The following groups (related to the concepts) of methods are available, most of them have a list(), create(), delete() and get() method attached.
  • client.user
  • client.organization
  • client.rule
  • client.role
  • client.collaboration
  • client.task
  • client.result
  • client.util
  • client.node

Example

1
help(client.task.create)
2
#Create a new task
3
#
4
# Parameters
5
# ----------
6
# collaboration : int
7
# Id of the collaboration to which this task belongs
8
# organizations : list
9
# Organization ids (within the collaboration) which need
10
# to execute this task
11
# name : str
12
# Human readable name
13
# image : str
14
# Docker image name which contains the algorithm
15
# description : str
16
# Human readable description
17
# input : dict
18
# Algorithm input
19
# data_format : str, optional
20
# IO data format used, by default LEGACY
21
# database: str, optional
22
# Name of the database to use. This should match the key
23
# in the node configuration files. If not specified the
24
# default database will be tried.
25
#
26
# Returns
27
# -------
28
# dict
29
# Containing the task information
Copied!
Last modified 29d ago
Export as PDF
Copy link
Contents
Example