convenient way to get data through Moodle's API
Project description
MoodleGet
convenient way to get data through Moodle's API
Setup
Install the package using pip:
pip install MoodleGet
Now you can open your project and import the MoodleAPI class
from MoodleGet import MoodleAPI
Initialising the class
url = "https://yourMoodle/webservice/rest/server.php"
token = your Moodle's API token
moodle = MoodleAPI(url, token)
Available methods
.call(function, data, params)
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 | {} |
.get_courses()
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
.get_calendar_events(courses_list)
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 | - |
License
This project is licensed under the MIT License - see the LICENSE file for details.
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.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file moodleget-1.0.tar.gz.
File metadata
- Download URL: moodleget-1.0.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ed7affdef33a757af9b6467855b589f10c07b18c79d00b042c3bae4841b3f42
|
|
| MD5 |
b26b61e1482eb058e2e14aa9738ecc26
|
|
| BLAKE2b-256 |
9584c353b82df2990be6cefa9f8ccf605f512010c2204a17770a80ee4feca1fe
|
File details
Details for the file MoodleGet-1.0-py3-none-any.whl.
File metadata
- Download URL: MoodleGet-1.0-py3-none-any.whl
- Upload date:
- Size: 4.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5f7f83cd34993944728f95e07af3cae253b7e26ee985081211b5e1727aae127
|
|
| MD5 |
282f82212bfd6b37823c927b35934689
|
|
| BLAKE2b-256 |
d90c8181d878a8de4990c5a2927f165d3bcdcf6b3449dbe4ea6317e5f5c0b31b
|