The main object-orientated API is built on top of WimsAPI class. Each method on WimsAPI maps one-to-one with an adm/raw request, and returns the response of the WIMS server.

It’s possible to use WimsAPI directly. Some basic things (e.g. getting a class from server) consist of several API calls and are complex to do with the low-level API, but it’s useful if you need extra flexibility and power.

## class WimsAPI WimsAPI(url, ident, passwd)

This class allow a python3 script to communicate with a WIMS server.

Parameters:


Two optionnal parameter can be passed to every method of this class:


Every method return a tuple (boolean, dictionnary), where dictionnary contains at least status, and code keys. Status is either the word ‘OK’ (which set boolean to True), or the word ‘ERROR’ (which set boolean to False).

In case the status is ‘OK’, the dictionnary can contains additionnals keys corresponding to the adm/raw response. In case the status is ‘ERROR’, key ‘message’ contains the nature of the error.

/! Warning: output must be set ident_type=json in WIMS_HOME/log/classes/.connections/IDENT for this API to work properly. See configuration

For more informations about adm/raw, see http://wims.unice.fr/wims/?module=adm/raw&job=help


addclass

addclass(self, qclass, rclass, class_info, supervisor_info, verbose=False, code=None, **kwargs)

Add a class on the receiving server.

Parameters:


addexam

addexam(self, qclass, rclass, exam_info, verbose=False, code=None, **kwargs)

Add an exam to the specified class.

Parameters:

addexo

addexo(self, qclass, rclass, qexo, exo_src, no_build=False, verbose=False, code=None, **kwargs)

Add an exercice to the specified class.

Parameters:

addsheet

addsheet(self, qclass, rclass, sheet_info, verbose=False, code=None, **kwargs)

Add a sheet to the specified class.

Parameters:

## adduser adduser(self, qclass, rclass, quser, user_info, verbose=False, code=None, **kwargs)

Add an user to the specified class.

Parameters:

authuser

authuser(self, qclass, rclass, quser, hashlogin=None, verbose=False, code=None, **kwargs)

Get an authentification token for an user.

User’s password is not required.

If parameter hashlogin is set to an hash function name, quser should be the external identification of user and the function hashlogin is called to convert such id to a WIMS login. If the user exists in class, it returns a session number as above. If the user does not exists, the WIMS login is returned in the error message.

Parameters:

buildexos

buildexos(self, qclass, rclass, verbose=False, code=None, **kwargs)

Compile every exercises of the specified class.

Parameters:

## checkclass checkclass(self, qclass, rclass, verbose=False, code=None, **kwargs)

Check whether the class accepts connection.

Parameters:

checkexam

checkexam(self, qclass, rclass, qexam, verbose=False, code=None, **kwargs)

Check whether the exam exists.

Parameters:

checkident

checkident(self, verbose=False, code=None, **kwargs)

Check whether the connection is accepted.

checksheet

checksheet(self, qclass, rclass, qsheet, verbose=False, code=None, **kwargs)

Check whether the sheet exists.

Parameters:

checkuser

**checkuser(self, qclass, rclass, quser, verbose=False, code=None, **kwargs)**

Check whether the user exists.

Parameters:

cleanclass

cleanclass(self, qclass, rclass, verbose=False, code=None, **kwargs)

Delete users (but supervisor) and all work done by students on the specified class.

Parameters:

copyclass

copyclass(self, qclass, rclass, verbose=False, code=None, **kwargs)

Copy a class. Do not copy users or work done by students.

Parameters:

delclass

delclass(self, qclass, rclass, verbose=False, code=None, **kwargs)

Delete a class.

Parameters:

delexam

delexam(self, qclass, rclass, qexam, verbose=False, code=None, **kwargs)

Delete an exam.

Parameters:

delexo

delexo(self, qclass, rclass, qexo, verbose=False, code=None, **kwargs)

Delete an exo.

Parameters:

delsheet

delsheet(self, qclass, rclass, qsheet, verbose=False, code=None, **kwargs)

Delete a sheet

Parameters:

deluser

deluser(self, qclass, rclass, quser, verbose=False, code=None, **kwargs)

Delete an user.

Parameters:

## getclass getclass(self, qclass, rclass, options=None, verbose=False, code=None, **kwargs)

Get the properties of a class.

Optionally, the parameter ‘options’ may contain the names of fields queried. In this case, only the queried properties are returned.

Existing properties are: password, creator, secure, external_auth, mixed_external_auth, cas_auth, php_auth, authidp, supervisor, description, institution, lang, email, expiration, limit, topscores, superclass, type, level, parent, typename, bgcolor, bgimg, scorecolor, css, logo, logoside, refcolor, ref_menucolor, ref_button_color, ref_button_bgcolor, ref_button_help_color, ref_button_help_bgcolor, theme, theme_icon, connections, creation, userlist, usercount, examcount, sheetcount

Parameters:

getclassesuser

getclassesuser(self, rclass, quser, verbose=False, code=None, **kwargs)

List all the classes having connection with rclass where quser exists.

Optionally, the parameter ‘options’ may contain the names of fields queried for each class. In this case, only the queried properties are returned.

Existing properties are: password, creator, secure, external_auth, mixed_external_auth, cas_auth, php_auth, authidp, supervisor, description, institution, lang, email, expiration, limit, topscores, superclass, type, level, parent, typename, bgcolor, bgimg, scorecolor, css, logo, logoside, refcolor, ref_menucolor, ref_button_color, ref_button_bgcolor, ref_button_help_color, ref_button_help_bgcolor, theme, theme_icon, connections, creation, userlist, usercount, examcount, sheetcount

Parameters:

getclassfile

getclassfile(self, qclass, rclass, filename, code=None, **kwargs)

Download the file of the specified class.

Parameters:

getclassmodif

getclassmodif(self, qclass, rclass, date, verbose=False, code=None, **kwargs)

List all the files modified on the specified class since .

Parameters:

getclasstgz

getclasstgz(self, qclass, rclass, code=None, **kwargs)

Download the class in a compressed (tar-gzip) file.

Parameters:

getcsv

getcsv(self, qclass, rclass, options, format='csv', code=None, **kwargs)

Get data of the class, under the form of a csv/tsv/xls spreatsheet file.

The parameter ‘format’ may be used to specify the desired output format (csv or tsv, defaults to csv).

The parameter ‘options’ should contain a list of desired data columns. The following names can be included in ‘option’, with their respective meanings:

The output content (below the status line in WIMS format) is a csv/tsv spreadsheet table. The first row of the table contains the names of the fields. The second row gives short descriptions of each field. The third row is blank. The rest is the table content, with one row for each user.

Parameters:

getexam

getexam(self, qclass, rclass, qexam, verbose=False, code=None, **kwargs)

Get an exam from a class.

Parameters:

getexamlog

getexamlog(self, qclass, rclass, quser, qexam, verbose=False, code=None, **kwargs)

Get the logs of on inside of a class.

Parameters:

getexamscores

getexamscores(self, qclass, rclass, qexam, verbose=False, code=None, **kwargs)

Get all scores from exam.

Parameters:

getexo(self, qclass, rclass, qsheet, qexo, verbose=False, code=None, **kwargs) Get an exercice from a sheet.

Parameters:

getexofile

getexofile(self, qclass, rclass, qexo, code=None, **kwargs)

Download the source file of the specified class.

Parameters:

getexosheet

getexosheet(self, qclass, rclass, qsheet, qexo, verbose=False, code=None, **kwargs)

Get informations of inside of of the specified class.

Parameters:

getinfoserver

getinfoserver(self, verbose=False, code=None, **kwargs)

Get informations about the WIMS server.

getlog

getlog(self, qclass, rclass, quser, verbose=False, code=None, **kwargs)

Get the detailed activity registry of an user.

Parameters:

getmodule

getmodule(self, module, verbose=False, code=None, **kwargs)

Get informations about .

Parameters:

getscore

getscore(self, qclass, rclass, quser, qsheet=None, verbose=False, code=None, **kwargs)

Get all scores from user. Can optionnally filter from a sheet.

Parameters:

getscores

getscores(self, qclass, rclass, options, code=None, **kwargs)

Call getcsv() method with format=‘xls’. For more informations, see WimsAPI.getcsv() documentation.

getsession

getsession(self, data1='adm/createxo', verbose=False, code=None, **kwargs)

Open a WIMS session and return its ID

getsheet

getsheet(self, qclass, rclass, qsheet, options=None, verbose=False, code=None, **kwargs)

Get the properties of a sheet (of a class).

Optionally, the parameter ‘options’ may contain the names of fields queried. In this case, only the queried properties are returned.

Existing properties are: exo_cnt, sheet_properties, sheet_status, sheet_expiration, sheet_title, sheet_description, exolist, title, params, points, weight, description

Parameters:

getsheetscores

getsheetscores(self, qclass, rclass, qsheet, verbose=False, code=None, **kwargs)

Get all scores from sheet.

Parameters:

getsheetstats

getsheetstats(self, qclass, rclass, qsheet, verbose=False, code=None, **kwargs)

Get stats about work of students for every exercise of .

Parameters:

gettime

gettime(self, verbose=False, code=None, **kwargs)

Get the current time of the server.

Can be used for synchronization purposes.

getuser

getuser(self, qclass, rclass, quser, options=None, verbose=False, code=None, **kwargs)

Get the properties of an user (of a class).

Optionally, the parameter ‘options’ may contain the names of fields queried. In this case, only the queried properties are returned.

Existing properties are: firstname, lastname, email, comments, regnum, photourl, participate, password, courses, classes, supervise, supervisable, external_auth, agreecgu, regprop1, regprop2, regprop3, regprop4, regprop5

Parameters:

lightpopup

lightpopup(self, qclass, rclass, quser, session, exercice, about=True, code=None, **kwargs)

Presents an exercise without the top, bottom, and left menu

Parameters:

linkexo

linkexo(self, qclass, rclass, qsheet, qexo, qexam, verbose=False, code=None, **kwargs)

Add exercise of the sheet to .

Parameters:

linksheet

linksheet(self, qclass, rclass, qsheet, qexam, verbose=False, code=None, **kwargs)

Add all exercices from sheet to exam.

Parameters:

listclasses

listclasses(self, rclass, verbose=False, code=None, **kwargs)

List all the classes having connection with rclass.

Optionally, the parameter ‘options’ may contain the names of fields queried for each class. In this case, only the queried properties are returned.

Existing properties are: password, creator, secure, external_auth, mixed_external_auth, cas_auth, php_auth, authidp, supervisor, description, institution, lang, email, expiration, limit, topscores, superclass, type, level, parent, typename, bgcolor, bgimg, scorecolor, css, logo, logoside, refcolor, ref_menucolor, ref_button_color, ref_button_bgcolor, ref_button_help_color, ref_button_help_bgcolor, theme, theme_icon, connections, creation, userlist, usercount, examcount, sheetcount

Parameters:

listexams

listexams(self, qclass, rclass, verbose=False, code=None, **kwargs)

Lists all exams presents in class.

Parameters:

listexos

listexos(self, qclass, rclass, verbose=False, code=None, **kwargs)

Lists all exercices presents in class.

Parameters:

listlinks(self, qclass, rclass, qsheet, qexam, verbose=False, code=None, **kwargs)

Get the number of exercise of linked to .

Parameters:

listmodules

listmodules(self, level='H4', verbose=False, code=None, **kwargs)

Get the number of exercise of linked to .

Parameters:

listsheets

listsheets(self, qclass, rclass, verbose=False, code=None, **kwargs)

List all the sheets of a class.

Parameters:

modclass

modclass(self, qclass, rclass, class_info, verbose=False, code=None, **kwargs)

Modify the properties of a class.

Parameters:

modexam

modexam(self, qclass, rclass, qexam, exam_info, verbose=False, code=None, **kwargs)

Modify the property of an exam.

Parameters:

modexosheet

modexosheet(self, verbose=False, code=None, **kwargs)

Not implemented yet.

modsheet

modsheet(self, qclass, rclass, qsheet, sheet_info, verbose=False, code=None, **kwargs)

Modify the properties of a sheet.

Parameters:

moduser

moduser(self, qclass, rclass, quser, user_info, verbose=False, code=None, **kwargs)

Modify the properties of an user.

Parameters:

movexo

movexo(self, qclass, qclass2, rclass, qsheet, copy=False, verbose=False, code=None, **kwargs)

Moves exercice from qclass to qclass2.

Condition : Both 2 classes must be linked by.
 

Parameters:

movexos

movexos(self, qclass, qclass2, rclass, copy=False, verbose=False, code=None, **kwargs)

Moves ALL exercices from qclass to qclass2.

Condition : Both 2 classes must be linked by.
 

Parameters:

putcsv

putcsv(self, qclass, rclass, csv, file=True, verbose=False, code=None, **kwargs)

Put data into the class.

csv should respect this format: The first row of the table contains the names of the fields. The second row gives short descriptions of each field. The second row is blank. The rest is the table content, with one row for each user. The following data columns can be included in the csv, with their respective meanings:

Parameters:

putexo

putexo(self, qclass, rclass, qsheet, module, options=None, verbose=False, code=None, **kwargs)

Add ’s exercise to of a specified class.

Parameters:

recuser

recuser(self, qclass, rclass, quser, verbose=False, code=None, **kwargs)

Recover a deleted user.

Parameters:

repairclass

repairclass(self, qclass, rclass, verbose=False, code=None, **kwargs)

Try to detect and correct eventual problems.

Parameters:

search(self, verbose=False, code=None, **kwargs)

Not implemented yet.

sharerecontent

sharerecontent(self, qclass, qclass2, rclass, options=('exo',), verbose=False, code=None, **kwargs)

Declares neighbour classes, allowing class “qclass” to share content with class “data1”. Both classes must be linked by.

Parameters:

testexo

testexo(self, exo_src, verbose=False, code=None, **kwargs)

Allow to test the compilation of an exercise without adding it to a class.

Parameters:

update

update(self, verbose=False, code=None, **kwargs)

Not implemented yet.