Python - API

#TODO: add content descriptions

api.normalize_url(host, path)[source]

Adds the path to the url, to get an full uri. Multiple “/” between host and path will be normalized to host/path


host : string

Hostname, maybe with port extension and protocoll

path : string

Path of the uri

class api.API(username=u'backend', password=u'foobar', host=u'http://localhost:8000/')[source]
add_group(name, public=True)[source]

Creates a new group


name : string

Name of the new group

public : boolean

Is the group joinable? Default: True


Requires admin rights.

add_job_picture(job_id, filename)[source]

Adds a picture to the job.


job_id : int

The ID of the job.

filename : string

Path to picture


Retrieves all points from a given dataset.


dataset_id : int

The ID of the dataset


List of point dicts.


Retrieves all stored datasets.

Returns:Dict{id: datasetinfo}

Load the job parameters. This is only used for workers and need admin rights.


job_id : int

The ID of the selected job.



  • algorithm
  • dataset
  • params

Joins the selected round.


Current user will be added the the selected group.


group_name : string

Name of the selected group


List all accessible groups

Returns:Dictionary with key is the name and value are group parameters.
load(path, raw=False, **kwargs)[source]

Load the required resource from the host.

If a login was successful, cookie session information are attached to the request. Also the CRFS-Token is added, if data is set. All values from data are transmitted via POST command.


path : string

path to the resource

raw : boolean

if True no JSON decoding is done

**kwargs : dict

Additional parameters which will be send as POST request.

login(username, password)[source]

Send login request. This is normally done by constructor.


username : string

The username of the user

password : string

The password of the user


True, if login was successful

HTML response otherwise


Ping the server and try to retrieve a new job to be processed.

Returns:Job ID if a new job is available or None if not.
update_job_details(job_id, score_test, score_validation, labels_training, labels_test, labels_validation, extra_scores_test=None, extra_scores_validation=None, message=None, success=True)[source]

Posts the job results to the server.


job_id : integer

The ID of the job

score_test : float

The score of the test set. Should be in the interval [0,1]

score_validation : float

The score of the validation set. Should be in the interval [0,1]

labels_training : list

A list of lables for the training set

labels_test : list

A list of lables for the test set

labels_validation : list

A list of labels for the validation set

extra_scores_test : dict (optional)

A dictionary with further scores (just for information) from the test set.

extra_scores_validation : dict (optional)

A dictionary with further scores (just for information) from the validation set.

message : string (optional)

A message from the training set. It could contain more information about the training/test.

pictures : list of filenames (optional)

A list of filenames with additional visualizations of the test set.

success : boolean (default: True)

True if the learning process was successful