https://github.com/hexatester/moodlepy
Python wrapper for moodle web service.
https://github.com/hexatester/moodlepy
lms moodle python-client python-wrapper webservice-client
Last synced: about 1 month ago
JSON representation
Python wrapper for moodle web service.
- Host: GitHub
- URL: https://github.com/hexatester/moodlepy
- Owner: hexatester
- License: mit
- Created: 2020-09-03T03:16:06.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-10-11T11:53:22.000Z (over 1 year ago)
- Last Synced: 2025-09-30T06:07:57.674Z (8 months ago)
- Topics: lms, moodle, python-client, python-wrapper, webservice-client
- Language: Python
- Homepage: https://hexatester.github.io/moodlepy/
- Size: 729 KB
- Stars: 30
- Watchers: 1
- Forks: 17
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# moodlepy
[](https://pypi.org/project/moodlepy/)
[](https://pypi.org/project/moodlepy/)
[](https://github.com/hexatester/moodlepy/blob/master/LICENSE)
[](https://github.com/hexatester/moodlepy/actions?query=workflow%3ATests)
[](https://codecov.io/gh/hexatester/moodlepy)
[](https://github.com/pre-commit/pre-commit)
[](https://github.com/python/mypy)
Python wrapper for moodle web service.
## Introduction
This library provide a pure Python interface for [Moodle Web Service](https://docs.moodle.org/dev/Web_services). It's compatible with Python versions 3.8+
> Install moodlepy<=0.22.2 for python 3.6 support.
> Install moodlepy<=0.23.8 for python 3.7 support.
## Installing
You can install or upgrade moodlepy with:
```bash
pip install moodlepy --upgrade
```
Or you can install from source with:
```bash
git clone https://github.com/hexatester/moodlepy
cd moodlepy
python setup.py install
```
## Usage
Example usage
```python
from moodle import Moodle
url = 'https://my.domain/webservice/rest/server.php'
token = 'super secret token'
moodle = Moodle(url, token)
dict_site_info = moodle('core_webservice_get_site_info')
site_info = moodle.core.webservice.get_site_info() # return typed site_info
print(dict_site_info)
print(site_info)
# or
from moodle import Mdl
from moodle.core.webservice import BaseWebservice
moodle = Mdl(url, token)
webservice = BaseWebservice(moodle)
site_info2 = webservice.get_site_info()
assert site_info == site_info2
```
❗️ If the function area does not have a type in the [support table](#moodle-web-service-support), the return value is in accordance with the [Moodle web service documentation](https://sandbox.moodledemo.net/admin/webservice/documentation.php), wich mostly dict.
In the future all of [Web service functions](https://docs.moodle.org/dev/Web_service_API_functions) will be covered by moodlepy.
## Moodle Web Service support
| Area | Functions | Types | Tests | Status |
| -------------------- | --------- | ----- | ----- | ------ |
| auth_email | A | A | | |
| block | A | A | | |
| core_auth | A | A | | |
| core_backup | A | A | | |
| core_badge | A | A | A | |
| core_blog | A | A | A | |
| core_calendar | A | A | | |
| core_cohort | A | A | | |
| core_comment | A | A | | |
| core_competency | | | | |
| core_completion | A | A | | |
| core_course | | | | |
| core_customfield | A | A | | |
| core_enrol | | | | |
| core_fetch | | | | |
| core_files | | | | |
| core_filters | | | | |
| core_form | | | | |
| core_get | | | | |
| core_grades | A | | | |
| core_grading | | | | |
| core_group | | | | |
| core_h5p | | | | |
| core_message | A | | | |
| core_notes | A | A | | |
| core_output | | | | |
| core_question | | | | |
| core_rating | | | | |
| core_role | | | | |
| core_search | | | | |
| core_session | | | | |
| core_tag | | | | |
| core_update | | | | |
| core_user | | | | |
| core_webservice | A | A | A | A |
| enrol_guest | A | A | | |
| enrol_manual | A | A | | |
| enrol_self | A | A | | |
| gradereport_overview | | | | |
| gradereport_user | | | | |
| gradingform_guide | | | | |
| gradingform_rubric | | | | |
| local_mobile | | | | |
| message_airnotifier | | | | |
| message_popup | | | | |
| mod_assign | | | | |
| mod_book | | | | |
| mod_chat | A | | | |
| mod_choice | | | | |
| mod_data | A | | | |
| mod_feedback | | | | |
| mod_folder | A | A | | |
| mod_forum | | | | |
| mod_glossary | | | | |
| mod_imscp | | | | |
| mod_label | | | | |
| mod_lesson | | | | |
| mod_lti | | | | |
| mod_page | A | A | | |
| mod_quiz | | | | |
| mod_resource | A | A | | |
| mod_scorm | | | | |
| mod_survey | | | | |
| mod_url | A | A | | |
| mod_wiki | | | | |
| mod_workshop | A | | | |
| report_competency | | | | |
| report_insights | | | | |
| tool_analytics | | | | |
| tool_lp | | | | |
| tool_mobile | A | A | | |
| tool_templatelibrary | | | | |
| tool_usertours | | | | |
| tool_xmldb | | | | |