Package: wimsapi
Python API for WIMS' adm/raw moduleWimsAPIis an API written in python3 allowing to communicate with aWIMSserver through itsadm/rawextension.For more information aboutadm/raw,see its documentationHere thedocumentation of wimsapi.InstallationThe latest stable version is available onPyPI:pipinstallwimsapior from the sources:gitclonehttps://github.com/qcoumes/wimsapicdwimsapi
python3setup.pyinstallConfigurationGlobal configurationIn order forWIMSto accept requests fromWimsAPI,
a file must be created in[WIMS_HOME]/log/classes/.connections/,
the file's name will serve as the identifier name forWimsAPI.Here an exemple of such file:[WIMS_HOME]/log/classes/.connections/myselfident_site=172.17.0.1

ident_desc=This WIMS server

ident_agent=python-requests

# http / https.
ident_protocol=http

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

ident_type=json

# The address and identifier/password pair for calling back.
back_url=http://localhost/wims/wims.cgi
back_ident=myself
back_password=totoHere a description of the important parameters:ident_site: a space separated list of IP allowed to send request to thisWIMSserver.ident_agent:Mustbe set topython-requests.ident_password: Used alongside the file's name asidentifierin the request
to authenticate yourself onWIMS.ident_type:Mustbe set tojson.The above example would allow a computer/server of ip172.17.0.1to send a request
to theWIMSserver with identifiermyselfand passwordtoto.Class ConfigurationIf 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]/.defand add
this line at the end of the file:!set class_connections=+IDENT/RCLASS+WhereIDENTis the identifier use by the API (name of the corresponding
file in[WIMS_HOME]/log/classes/.connections/as defined above) andRCLASSis an identifier sent in the request to authenticate yourself
on the class.Basically, to authenticate yourself on a class on yourWIMSserver, you
will need :url: URL to theWIMS(https://wims.unice.fr/wims/wims.cgifor instance)ident: Name of the file in[WIMS_HOME]/log/classes/.connections/passwd: Value ofident_passwordin[WIMS_HOME]/log/classes/.connections/[IDENT]rclass: Value set after the/inclass_connectionsin[WIMS_HOME]/log/classes/[CLASS_ID]/.defExamplefromwimsapiimportClass,Userc=Class.get("https://wims.unice.fr/wims/wims.cgi","myself","toto",9999,"myclass")c.institution="Another institution"# Modify class' institutionc.save()u=User.get(c,"qcoumes")u.email="coumes.quentin@gmail.com"# Modify user's emailu.save()new=User("quser","lastname","firstname","password","mail@mail.com")c.additem(new)# Add the new user to the class.For more informations about usage or example : Here the completedocumentation of wimsapi.TestingTo testwimsapi, you will need a running WIMS' server. If needed, you can set up one quickly with docker using the DockerFilehere, following theREADMEsteps.The default URL used for tests ishttp://localhost:7777/wims/wims.cgi, you can override it with the environment variableWIMS_URL. For instance:WIMS_URL=http://mywims.com/wims/wims.cgipytestChangelog0.5.11api.WimsAPI.authusernow accept anipargument, allowing a persistent session for the
same IP. (Contributed by Gianluca Amato)0.5.10WIMS accept request saving user with invalidquser, removing or changing
invalid character. Butwimsapiwas taking this change into account, thequserattribute of the user was thus invalid, causing problem when further communicating with
the WIMS server.To solve this problemUser.save()now has aadapt=Truekeyword argument. WhenTrue,
thequserattribute will be modified to match the one used by WIMS. IfFalse, the
user created on the WIMS server with the modifierquserwill be deleted and the new
exceptionInvalidIdentifierwill be raised.0.5.9Keyword argument that will be passed to every call ofrequest.post()can now
be given toWimsApiconstructor.Every method ofClasscreating aWimsAPIcan also receive such argument
(check(),save(),get(),list())Now usesdistinstead ofbdistto create new distribution.0.5.8Now use Github action for testing and publishing0.5.7Added__str__method to InvalidResponseError.0.5.6Addedresponsefield to InvalidResponseError.0.5.5Added InvalidResponseError exception in api.py when WIMS send a badly formatted response.O.5.4Append/at the end of the WIMS server's url if it is not present when usingWimsAPI.Added adm/raw API to the documentation.0.5.3Default timeout for low level API is now 10 seconds (instead of 120).0.5.2Parameters ofapi.pyrequests are now encoding inISO-8859-1, mathching WIMS'
default encodingAdding__repr__and__str__method toClassandItemsubtypes.Getting Exams from the WIMS server now retrieve the correct status.0.5.1Fix sheet's score computation0.5.0Added classesExamandExamScore,ExerciseScoreandSheetScoreto store scoresSheet/Exam:Title and description are now optionnal in constructor.Added methodscores(user=None)to retrieve the score of one or every user.Added class methodcheck()toClassto check wheter a class exists or not.Better__eq__and__hash__for every class.0.4.1Listing functions now return an empty list when needed0.4.0Added new item :SheetAdded the possibility to list items and classes throughClass.list()andclass.listitem().Added__eq__()for items and classes.Fixed some documentation0.3.9Renamed Class memberdatetoexpirationto match theADM/RAWargument.Class.limitis now anintwhen retrieving the class from aWIMSserver.Now propagate exception if expiration in Class__init__is notyyyymmdd.0.3.7 & 0.3.8check_existsis now used properly0.3.6Addedcheck_exists=Trueparameter 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 usecheck_exists=False.Fix response check inwclass.save()0.3.5Fix missingself.lang = langinClass'__init__0.3.4Fixlong_descriptionin setup.py0.3.3qclassargument is now optionnal in Class constructor,
allowing WIMS to choose a freeqclasswhen saving for
the fist time.0.3.2FixedWimsAPI.putexo().Updated tests and unskipped some according to latest WIMS version.0.3.1Fixed buggy import in setup.py0.3.0AddingClassehigher level API, allowing to manipulate a WIMS' Class.AddingUserhigher level API, allowing to manipulate a WIMS' User.Adding documentation.0.2.2More tests.0.2.1Fixed travis CI.0.2.0Add User and Class higher level classes.Add some tests fomr WimsApi.Add Travis CI.0.1.0Initial public release.