moodlepy


Namemoodlepy JSON
Version 0.24.0 PyPI version JSON
download
home_pagehttps://hexatester.github.io/moodlepy/
SummaryPython wrapper for moodle web service.
upload_time2023-08-30 18:26:51
maintainer
docs_urlNone
authorhexatester
requires_python>=3.8.10,<4.0.0
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": "",
    "docs_url": null,
    "requires_python": ">=3.8.10,<4.0.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "hexatester",
    "author_email": "habibrohman@protonmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d4/e5/4f919cba9a0026b2a25d7c8bd73d834517e1a78870a1f4baf3f4a5f1963e/moodlepy-0.24.0.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.0",
    "project_urls": {
        "Homepage": "https://hexatester.github.io/moodlepy/",
        "Repository": "https://github.com/hexatester/moodlepy"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0e2185da6db64962e785214f6046f2a1a92ab26b5285db39dc0397bfb58799cf",
                "md5": "e63613c7b4f8b8d70fae5cca37c0885b",
                "sha256": "599e88cac56b1aeea39d7b85a2d3fd3a947e5ea90b68651996ebe7b4d2e6d6d2"
            },
            "downloads": -1,
            "filename": "moodlepy-0.24.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "e63613c7b4f8b8d70fae5cca37c0885b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.10,<4.0.0",
            "size": 152998,
            "upload_time": "2023-08-30T18:26:50",
            "upload_time_iso_8601": "2023-08-30T18:26:50.462383Z",
            "url": "https://files.pythonhosted.org/packages/0e/21/85da6db64962e785214f6046f2a1a92ab26b5285db39dc0397bfb58799cf/moodlepy-0.24.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d4e54f919cba9a0026b2a25d7c8bd73d834517e1a78870a1f4baf3f4a5f1963e",
                "md5": "da9fd1a06ed7b40e2fc239536b396179",
                "sha256": "30fd715474a95c8d44f818f7932bbc904c7ee0e05a4514fa9239fcab74311c7d"
            },
            "downloads": -1,
            "filename": "moodlepy-0.24.0.tar.gz",
            "has_sig": false,
            "md5_digest": "da9fd1a06ed7b40e2fc239536b396179",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.10,<4.0.0",
            "size": 82152,
            "upload_time": "2023-08-30T18:26:51",
            "upload_time_iso_8601": "2023-08-30T18:26:51.743216Z",
            "url": "https://files.pythonhosted.org/packages/d4/e5/4f919cba9a0026b2a25d7c8bd73d834517e1a78870a1f4baf3f4a5f1963e/moodlepy-0.24.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-08-30 18:26:51",
    "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: 0.11512s