moodlepy


Namemoodlepy JSON
Version 0.24.1 PyPI version JSON
download
home_pagehttps://hexatester.github.io/moodlepy/
SummaryPython wrapper for moodle web service.
upload_time2024-10-11 11:53:45
maintainerNone
docs_urlNone
authorhexatester
requires_python<4.0.0,>=3.8.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # moodlepy

[![PyPi Package Version](https://img.shields.io/pypi/v/moodlepy)](https://pypi.org/project/moodlepy/)
[![Supported Python versions](https://img.shields.io/pypi/pyversions/moodlepy)](https://pypi.org/project/moodlepy/)
[![LICENSE](https://img.shields.io/github/license/hexatester/moodlepy)](https://github.com/hexatester/moodlepy/blob/master/LICENSE)
[![Tests](https://github.com/hexatester/moodlepy/workflows/Tests/badge.svg)](https://github.com/hexatester/moodlepy/actions?query=workflow%3ATests)
[![codecov](https://codecov.io/gh/hexatester/moodlepy/branch/master/graph/badge.svg)](https://codecov.io/gh/hexatester/moodlepy)
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)
[![Mypy](https://img.shields.io/badge/Mypy-enabled-brightgreen)](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           |           |       |       |        |

            

Raw data

            {
    "_id": null,
    "home_page": "https://hexatester.github.io/moodlepy/",
    "name": "moodlepy",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0.0,>=3.8.10",
    "maintainer_email": null,
    "keywords": null,
    "author": "hexatester",
    "author_email": "habibrohman@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/69/83/d03072735fc822b225efefa7f7646a4ed6cd73d1c717a338871b9958ce5d/moodlepy-0.24.1.tar.gz",
    "platform": null,
    "description": "# moodlepy\n\n[![PyPi Package Version](https://img.shields.io/pypi/v/moodlepy)](https://pypi.org/project/moodlepy/)\n[![Supported Python versions](https://img.shields.io/pypi/pyversions/moodlepy)](https://pypi.org/project/moodlepy/)\n[![LICENSE](https://img.shields.io/github/license/hexatester/moodlepy)](https://github.com/hexatester/moodlepy/blob/master/LICENSE)\n[![Tests](https://github.com/hexatester/moodlepy/workflows/Tests/badge.svg)](https://github.com/hexatester/moodlepy/actions?query=workflow%3ATests)\n[![codecov](https://codecov.io/gh/hexatester/moodlepy/branch/master/graph/badge.svg)](https://codecov.io/gh/hexatester/moodlepy)\n[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white)](https://github.com/pre-commit/pre-commit)\n[![Mypy](https://img.shields.io/badge/Mypy-enabled-brightgreen)](https://github.com/python/mypy)\n\nPython wrapper for moodle web service.\n\n## Introduction\n\nThis 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+\n\n> Install moodlepy<=0.22.2 for python 3.6 support.\n> Install moodlepy<=0.23.8 for python 3.7 support.\n\n## Installing\n\nYou can install or upgrade moodlepy with:\n\n```bash\npip install moodlepy --upgrade\n```\n\nOr you can install from source with:\n\n```bash\ngit clone https://github.com/hexatester/moodlepy\ncd moodlepy\npython setup.py install\n```\n\n## Usage\n\nExample usage\n\n```python\nfrom moodle import Moodle\nurl = 'https://my.domain/webservice/rest/server.php'\ntoken = 'super secret token'\nmoodle = Moodle(url, token)\ndict_site_info = moodle('core_webservice_get_site_info')\nsite_info = moodle.core.webservice.get_site_info()  # return typed site_info\n\nprint(dict_site_info)\nprint(site_info)\n\n# or\nfrom moodle import Mdl\nfrom moodle.core.webservice import BaseWebservice\n\nmoodle = Mdl(url, token)\nwebservice = BaseWebservice(moodle)\nsite_info2 = webservice.get_site_info()\n\nassert site_info == site_info2\n```\n\n\u2757\ufe0f 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.\n\nIn the future all of [Web service functions](https://docs.moodle.org/dev/Web_service_API_functions) will be covered by moodlepy.\n\n## Moodle Web Service support\n\n| Area                 | Functions | Types | Tests | Status |\n| -------------------- | --------- | ----- | ----- | ------ |\n| auth_email           | A         | A     |       |        |\n| block                | A         | A     |       |        |\n| core_auth            | A         | A     |       |        |\n| core_backup          | A         | A     |       |        |\n| core_badge           | A         | A     | A     |        |\n| core_blog            | A         | A     | A     |        |\n| core_calendar        | A         | A     |       |        |\n| core_cohort          | A         | A     |       |        |\n| core_comment         | A         | A     |       |        |\n| core_competency      |           |       |       |        |\n| core_completion      | A         | A     |       |        |\n| core_course          |           |       |       |        |\n| core_customfield     | A         | A     |       |        |\n| core_enrol           |           |       |       |        |\n| core_fetch           |           |       |       |        |\n| core_files           |           |       |       |        |\n| core_filters         |           |       |       |        |\n| core_form            |           |       |       |        |\n| core_get             |           |       |       |        |\n| core_grades          | A         |       |       |        |\n| core_grading         |           |       |       |        |\n| core_group           |           |       |       |        |\n| core_h5p             |           |       |       |        |\n| core_message         | A         |       |       |        |\n| core_notes           | A         | A     |       |        |\n| core_output          |           |       |       |        |\n| core_question        |           |       |       |        |\n| core_rating          |           |       |       |        |\n| core_role            |           |       |       |        |\n| core_search          |           |       |       |        |\n| core_session         |           |       |       |        |\n| core_tag             |           |       |       |        |\n| core_update          |           |       |       |        |\n| core_user            |           |       |       |        |\n| core_webservice      | A         | A     | A     | A      |\n| enrol_guest          | A         | A     |       |        |\n| enrol_manual         | A         | A     |       |        |\n| enrol_self           | A         | A     |       |        |\n| gradereport_overview |           |       |       |        |\n| gradereport_user     |           |       |       |        |\n| gradingform_guide    |           |       |       |        |\n| gradingform_rubric   |           |       |       |        |\n| local_mobile         |           |       |       |        |\n| message_airnotifier  |           |       |       |        |\n| message_popup        |           |       |       |        |\n| mod_assign           |           |       |       |        |\n| mod_book             |           |       |       |        |\n| mod_chat             | A         |       |       |        |\n| mod_choice           |           |       |       |        |\n| mod_data             | A         |       |       |        |\n| mod_feedback         |           |       |       |        |\n| mod_folder           | A         | A     |       |        |\n| mod_forum            |           |       |       |        |\n| mod_glossary         |           |       |       |        |\n| mod_imscp            |           |       |       |        |\n| mod_label            |           |       |       |        |\n| mod_lesson           |           |       |       |        |\n| mod_lti              |           |       |       |        |\n| mod_page             | A         | A     |       |        |\n| mod_quiz             |           |       |       |        |\n| mod_resource         | A         | A     |       |        |\n| mod_scorm            |           |       |       |        |\n| mod_survey           |           |       |       |        |\n| mod_url              | A         | A     |       |        |\n| mod_wiki             |           |       |       |        |\n| mod_workshop         | A         |       |       |        |\n| report_competency    |           |       |       |        |\n| report_insights      |           |       |       |        |\n| tool_analytics       |           |       |       |        |\n| tool_lp              |           |       |       |        |\n| tool_mobile          | A         | A     |       |        |\n| tool_templatelibrary |           |       |       |        |\n| tool_usertours       |           |       |       |        |\n| tool_xmldb           |           |       |       |        |\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Python wrapper for moodle web service.",
    "version": "0.24.1",
    "project_urls": {
        "Homepage": "https://hexatester.github.io/moodlepy/",
        "Repository": "https://github.com/hexatester/moodlepy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "186bc526e3230e20171d7791f0fb2137aa4b49c82d9878959f089be1162a7c72",
                "md5": "7d8af8a15361defa0e0146855b85f599",
                "sha256": "2809ece7a167d7ecc2a744cde188f0af66e1db58863e7a2ed77d1a0b08ff82e2"
            },
            "downloads": -1,
            "filename": "moodlepy-0.24.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "7d8af8a15361defa0e0146855b85f599",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0.0,>=3.8.10",
            "size": 153323,
            "upload_time": "2024-10-11T11:53:44",
            "upload_time_iso_8601": "2024-10-11T11:53:44.149673Z",
            "url": "https://files.pythonhosted.org/packages/18/6b/c526e3230e20171d7791f0fb2137aa4b49c82d9878959f089be1162a7c72/moodlepy-0.24.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6983d03072735fc822b225efefa7f7646a4ed6cd73d1c717a338871b9958ce5d",
                "md5": "5d131c6ca0d9c068d06ae7c52190e4a7",
                "sha256": "94d361e4da56748d29910e01979e4652a42220994112b4f07589f200cb7915e3"
            },
            "downloads": -1,
            "filename": "moodlepy-0.24.1.tar.gz",
            "has_sig": false,
            "md5_digest": "5d131c6ca0d9c068d06ae7c52190e4a7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0.0,>=3.8.10",
            "size": 82174,
            "upload_time": "2024-10-11T11:53:45",
            "upload_time_iso_8601": "2024-10-11T11:53:45.433877Z",
            "url": "https://files.pythonhosted.org/packages/69/83/d03072735fc822b225efefa7f7646a4ed6cd73d1c717a338871b9958ce5d/moodlepy-0.24.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-11 11:53:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hexatester",
    "github_project": "moodlepy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "moodlepy"
}
        
Elapsed time: 2.46345s