A Python 3 implementation of WIMS adm/raw module.
Project description
WimsAPI
A Python 3 implementation of WIMS adm/raw module.
The connectable server must be declared in a file
within the directory WIMS_HOME/log/classes/.connections/
.
/!\ Warning: output must be set ident_type=json
in WIMS_HOME/log/classes/.connections/IDENT
for
this API to work properly.
Low-level API
Many low-level method allow to directly send a request to a WIMS server. The currently avalaible requests are:
addclass()
- Add a class on the receiving server.addexam()
- Add an exam to the specified class.addexo()
- Add an exercice to the specified class.addsheet()
- Add a sheet to the specified claadduser()
- Add an user to the specified class.authuser()
- Get an authentification token for an user.buildexos()
- Compile every exercises of the specified class.checkclass()
- Check whether the class accepts connection.checkexam()
- Check whether the exam exists.checkident()
- Check whether the connection is accepted.checksheet()
- Check whether the sheet exists.checkuser()
- Check whether the user exists.cleanclass()
- Delete users (but supervisor) and all work done by students on the specified class.copyclass()
- Copy a class. Do not copy users or work done by students.delclass()
- Delete a class.delexam()
- Delete an exam.delexo()
- Delete an exo.delsheet()
- Delete a sheet.deluser()
- Delete an user.getclass()
- Get the properties of a class.getclassesuser()
- List all the classes having connection with rclass where quser exists.getclassfile()
- Download the file of the specified class.getclassmodif()
- List all the files modified on the specified class since .getclasstgz()
- Download the class in a compressed (tar-gzip) file.getcsv()
- Get data of the class, under the form of a csv/tsv/xls spreatsheet file.getexam()
- Get an exam from a class.getexamlog()
- Get the logs of on inside of a class.getexamscores()
- Get all scores from exam.getexo()
- Get an exercice from a sheet.getexofile()
- Download the source file of the specified class.getexosheet()
- Get informations of inside of of the specified class.getinfoserver()
- Get informations about the WIMS server.getlog()
- Get the detailed activity registry of an user.getmodule()
- Get informations about .getscore()
- Get all scores from user.getscores()
- Call getcsv() method with format='xls'.getsession()
- Open a WIMS session and return its ID.getsheet()
- Get the properties of a sheet (of a class).getsheetscores()
- Get all scores from sheet.getsheetstats()
- Get stats about work of students for every exercise of .gettime()
- Get the current time of the server.getuser()
- Get the properties of an user of .lightpopup()
- Presents an exercise without the top, bottom, and left menulinkexo()
- Add exercise of the sheet to .linksheet()
- Add all exercices from sheet to exam.listclasses()
- List all the classes having connection with rclass.listexams()
- Lists all exams presents in class.listexos()
- Lists all exercices presents in class.listlinks()
- Get the number of exercise of linked to .listmodules()
- Get the number of exercise of linked to .listsheets()
- List all the sheets of a class.modclass()
- Modify the properties of a class.modexam()
- Modify the property of an exam.modexosheet()- Not implemented yetmodsheet()
- Modify the properties of a sheet.moduser()
- Modify the properties of an user.movexo()
- Moves exercice from qclass to qclass2.movexos()
- Moves ALL exercices from qclass to qclass2.putcsv()
- Put data into the class.putexo()
- Add 's exercise to of a specified class.recuser()
- Recover a deleted user.repairclass()
- Try to detect and correct eventual problems.search()- Not implemented yetsharecontent()
- Declares neighbour classes, allowing class "qclass" to share content with class "data1"testexo()
- Allow to test the compilation of an exercise without adding it to a class.update()- Not implemented yet
Each of these method return a dictionnary containing the response of the WIMS server.
For more information, consult the docstring of the corresponding method in wimsapi/api.py
.
To use any of these method, you must first declare an object WimsAPI(url, ident, password)
where:
url
is the url to the wims server CGI. e.g. https://wims.unice.fr/wims/wims.cgiident
is the sender identifier (a word, according to the definition in WIMS_HOME/log/classes/.connections/)password
is the sender password (as defined in WIMS_HOME/log/classes/.connections/)
Example:
>>> from wimsapi import WimsAPI
>>>
>>> api = WimsAPI('https://wims.unice.fr/wims/wims.cgi', 'ident', 'toto')
>>> status, response = api.checkident()
>>> if not status: # Connection failed
print("Can't establish a connection with the WIMS server: ", response['message'])
>>>
>>> api.getclass(9001, "myclass")
True, {'status': 'OK', 'code': 'I38EDGPL4W', 'job': 'getclass', 'query_class': '9001', 'rclass': 'myclass', 'password': '', 'creator': '', 'secure': 'all', 'external_auth': '', 'mixed_external_auth': '', 'cas_auth': '', 'php_auth': '', 'authidp': '', 'supervisor': 'Sophie, Lemaire; Bernadette, Perrin-Riou', 'description': 'Aide au d veloppement de ressources.', 'institution': 'Classe ouverte pour enseignants', 'lang': 'fr', 'email': 'sophie.lemaire@math.u-psud.fr', 'expiration': '21000101', 'limit': '200', 'topscores': '', 'superclass': '', 'type': '', 'level': 'R', 'parent': '', 'typename': 'class', 'bgcolor': '', 'bgimg': '', 'scorecolor': '', 'css': '-theme-', 'logo': 'gifs/logo/wimsedu.png', 'logoside': 'left', 'refcolor': '', 'ref_menucolor': '', 'ref_button_color': '', 'ref_button_bgcolor': '', 'ref_button_help_color': '', 'ref_button_help_bgcolor': '', 'theme': '', 'theme_icon': '', 'sendmailteacher': '', '': '', 'connections': '+myself/myclass+', 'creation': '20070929', 'userlist': ['anonymous', 'user'], 'usercount': '2', 'examcount': '0', 'sheetcount': '11'}
>>>
>>> api.getclass(170666, "myclass")
False, {'status': 'ERROR', 'code': '6SSLZCEGN6', 'message': 'class 170666 not existing'}
___# Changelog
0.2.0
- Add User and Class higher level classes
- Add some tests fomr WimsApi
- Add Travis CI
0.1.0
- Initial public release
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.