Skip to main content

A Python 3 implementation of WIMS adm/raw module.

Project description

Python package codecov CodeFactor Documentation Status PyPI Version Python 3.5+ License MIT

Python API for WIMS' adm/raw module

WimsAPI is an API written in python3 allowing to communicate with a WIMS server through its adm/raw extension.

For more information about adm/raw, see its documentation

Here the documentation of wimsapi.


The latest stable version is available on PyPI :

pip install wimsapi

or from the sources:

git clone
cd wimsapi
python3 install


Global configuration

In order for WIMS to accept requests from WimsAPI, a file must be created in [WIMS_HOME]/log/classes/.connections/, the file's name will serve as the identifier name for WimsAPI.

Here an exemple of such file: [WIMS_HOME]/log/classes/.connections/myself


ident_desc=This WIMS server


# http / https.

# password must be a word composed of alpha-numeric characters.


# The address and identifier/password pair for calling back.

Here a description of the important parameters:

  • ident_site: a space separated list of IP allowed to send request to this WIMS server.
  • ident_agent: Must be set to python-requests.
  • ident_password: Used alongside the file's name as identifier in the request to authenticate yourself on WIMS.
  • ident_type: Must be set to json.

The above example would allow a computer/server of ip to send a request to the WIMS server with identifier myself and password toto.

Class Configuration

If you create a class thanks to this API, everything should work perfectly. However, if you want to use it with an already existing class, some more configuration must be done.

You must edit the file [WIMS_HOME]/log/classes/[CLASS_ID]/.def and add this line at the end of the file:

!set class_connections=+IDENT/RCLASS+

Where IDENT is the identifier use by the API (name of the corresponding file in [WIMS_HOME]/log/classes/.connections/ as defined above) and RCLASS is an identifier sent in the request to authenticate yourself on the class.

Basically, to authenticate yourself on a class on your WIMS server, you will need :

  • url : URL to the WIMS ( for instance)
  • ident : Name of the file in [WIMS_HOME]/log/classes/.connections/
  • passwd : Value of ident_password in [WIMS_HOME]/log/classes/.connections/[IDENT]
  • rclass : Value set after the / in class_connections in [WIMS_HOME]/log/classes/[CLASS_ID]/.def


from wimsapi import Class, User

c = Class.get("", "myself", "toto", 9999, "myclass")

c.institution = "Another institution"  # Modify class' institution

u = User.get(c, "qcoumes") = ""  # Modify user's email

new = User("quser", "lastname", "firstname", "password", "")
c.additem(new)  # Add the new user to the class.

For more informations about usage or example : Here the complete documentation of wimsapi.


To test wimsapi, you will need a running WIMS' server. If needed, you can set up one quickly with docker using the DockerFile here, following the README steps.

The default URL used for tests is http://localhost:7777/wims/wims.cgi, you can override it with the environment variable WIMS_URL. For instance:

WIMS_URL= pytest



  • api.WimsAPI.authuser now accept an ip argument, allowing a persistent session for the same IP. (Contributed by Gianluca Amato)


  • WIMS accept request saving user with invalid quser, removing or changing invalid character. But wimsapi was taking this change into account, the quser attribute of the user was thus invalid, causing problem when further communicating with the WIMS server.
    To solve this problem now has a adapt=True keyword argument. When True, the quser attribute will be modified to match the one used by WIMS. If False, the user created on the WIMS server with the modifier quser will be deleted and the new exception InvalidIdentifier will be raised.


  • Keyword argument that will be passed to every call of can now be given to WimsApi constructor.
  • Every method of Class creating a WimsAPI can also receive such argument (check(), save(), get(), list())
  • Now use sdist instead of bdist to create new distribution.


  • Now use Github action for testing and publishing


  • Added __str__ method to InvalidResponseError.


  • Added response field to InvalidResponseError.


  • Added InvalidResponseError exception in when WIMS send a badly formatted response.


  • Append / at the end of the WIMS server's url if it is not present when using WimsAPI.

  • Added adm/raw API to the documentation.


  • Default timeout for low level API is now 10 seconds (instead of 120).


  • Parameters of requests are now encoding in ISO-8859-1, mathching WIMS' default encoding

  • Adding __repr__ and __str__ method to Class and Item subtypes.

  • Getting Exams from the WIMS server now retrieve the correct status.


  • Fix sheet's score computation


  • Added classes Exam and ExamScore, ExerciseScore and SheetScore to store scores

  • Sheet / Exam:

    • Title and description are now optionnal in constructor.
    • Added method scores(user=None) to retrieve the score of one or every user.
  • Added class method check() to Class to check wheter a class exists or not.

  • Better __eq__ and __hash__ for every class.


  • Listing functions now return an empty list when needed


  • Added new item : Sheet
  • Added the possibility to list items and classes through Class.list() and class.listitem().
  • Added __eq__() for items and classes.
  • Fixed some documentation


  • Renamed Class member date to expiration to match the ADM/RAW argument.
  • Class.limit is now an int when retrieving the class from a WIMS server.
  • Now propagate exception if expiration in Class __init__ is not yyyymmdd.

0.3.7 & 0.3.8

  • check_exists is now used properly


  • Added check_exists=True parameter to item's save method.
    If check_exists is True, the api will check if an item with the same ID exists on the WIMS' server. If it exists, save will instead modify this item instead of trying to create new one.
    wclass.additem() will now use check_exists=False.
  • Fix response check in


  • Fix missing self.lang = lang in Class' __init__


  • Fix long_description in


  • qclass argument is now optionnal in Class constructor, allowing WIMS to choose a free qclass when saving for the fist time.


  • Fixed WimsAPI.putexo().
  • Updated tests and unskipped some according to latest WIMS version.


  • Fixed buggy import in


  • Adding Classe higher level API, allowing to manipulate a WIMS' Class.
  • Adding User higher level API, allowing to manipulate a WIMS' User.
  • Adding documentation.


  • More tests.


  • Fixed travis CI.


  • Add User and Class higher level classes.
  • Add some tests fomr WimsApi.
  • Add Travis CI.


  • Initial public release.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

wimsapi-0.5.11.tar.gz (31.3 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page