GithubHelp home page GithubHelp logo

gospelbg / moodle-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from evickastudio/moodle-api

0.0 0.0 0.0 6 KB

A Python-based API wrapper designed for streamlined interaction with Moodle platforms. Handles authentication, session management, and basic data retrieval.

Python 100.00%

moodle-api's Introduction

Moodle API Wrapper for Python

Abstract

This project aims to develop a simple and easy-to-use Python API wrapper for Moodle.The wrapper will handle authentication, session management, and basic data retrieval. This wrapper is a standalone project, i intended to create a separate project that will deploy it as a notification bot with potential AI integrations like GPT-3/GPT-4 for summarizing or classifying the data.

Features

Core

  • Authentication: Handle login and maintain session.
  • Data Retrieval: Methods for fetching site info and notifications.

Implementation Details

Methods

  • login(username, password): Authenticate and initialize session.
  • get_site_info(): Retrieve site-specific information.
  • get_popup_notifications(user_id): Fetch user-specific popup notifications.
  • popup_notification_unread_count(user_id): Fetch user-specific unread popup notifications count.

To-Do List

  1. Complete current methods.
  2. Extend wrapper with additional Moodle API endpoints.

Usage

Example of initializing and using the wrapper:

moodle = MoodleAPI()
if moodle.login("username", "password"):
    site_info = moodle.get_site_info()
    print(site_info)
    notifications = moodle.get_popup_notifications(site_info["userid"])
    print(notifications) # Print all notifications
    print(notifications["notifications"][0]) # Prints the latest notification

Additional Remarks

  • Wrapper is independent and intended for use in a separate server-deployed application.
  • Token-based authentication and session management is implemented.

Contributing

  • Contributions for extending functionality are welcome.

Inspiration

  • moodle-dl

Roadmap

  • Improve while studying
  • Rewrite in another programming language like java or go
  • Deploy on server -> get data to your phone

Caveats and Observations

  • Moodle's official API documentation lacks comprehensiveness; code inspection from alternative projects is often required for better understanding for non professional developers.
  • Deviation from standard REST practices: API parameters are passed via URL, not in the request body.
  • Accurate wsfunction (Web Service Functions) and its corresponding parameters are prerequisites for specific data retrieval. Many of these functions wont work due to the lack of permissions or implementation on the server side.
  • API's base URL structure: subdomain.example.com/webservice/rest/server.php.

moodle-api's People

Contributors

evickastudio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.