test_moodle_api.py
The snippet can be accessed without any authentication.
Authored by
Jean-Francois.Burdet
test_moodle_api.py 507 B
if __name__ == "__main__":
start = dateutil.parser.isoparse('2021-06-16T10:00:00')
duration = 120
code = "BT01141"
session_tag_suffix = "_2021_jun"
ws = moodle.MoodleWS("08f99e710e9eb1a2a20e49879ac4aec4", "http://127.0.0.1", "/webservice/rest/server.php")
courses = ws.get_courses_by_field("shortname", code+session_tag_suffix)
if len(courses) >= 0:
res = ws.update_course(courses[0]["id"], "visible", 0)
res = ws.update_course(courses[0]["id"], "lang", "fr")
Please register or sign in to comment