convenient way to get data through Moodle's API
Install the package using pip:
pip install MoodleGet
Now you can open your project and import the MoodleAPI class
from MoodleGet import MoodleAPI
url = "https://yourMoodle/webservice/rest/server.php"
token = your Moodle's API token
moodle = MoodleAPI(url, token)
Send a post request to Moodle through their API system. Returns the response from Moodle in json format
| argument | expected type | required | default value |
|---|---|---|---|
| function | string | yes | - |
| data | dict | no | {"wstoken": self.token, "wsfunction": function, "moodlewsrestformat": "json"} |
| params | dict | no | {} |
Find all the courses that the user can see.
Returns a tuple (courses_dict, course_id_list), where
courses_dict is a dictionary, where keys are the course id-s and every key has a list set to it's value. The list contains [course's code, course's name in a readable way]
course_id_list is a list that has all the course's id-s as it's elements for convenient access
Finds all the calendar events in Moodle calendar in the time period now until 3 weeks from now.
Returns a list of the events, where every element of the list is another list containing: [event_id, name, events_course_id, exercise_type, event_starttime]
| argument | expected type | required | default value |
|---|---|---|---|
| courses_list | list | yes | - |
This project is licensed under the MIT License - see the LICENSE file for details.