Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Moodle web services (2.5) connection library

Project description

Moodle - Webservice Moodle in Python
================================================================================
Webservice functions to Moodle

Installation
--------------------------------------------------------------------------------
Installing Moodle Webservice is fairly easy. You can...

sudo python setup.py install

Setting up Moodle 2.2.x web services
--------------------------------------------------------------------------------
Follow the steps in /admin/settings.php?section=webservicesoverview of your moodle.

Example Use
--------------------------------------------------------------------------------
Create a new course:

from moodle_ws_client import moodle
mdl = moodle.MDL()

# Connect to moodle data
server = {
'protocol': 'xmlrpc', # xmlrpc, rest
'uri': 'http://www.mymoodle.org',
'token': 'yourtokenkeymoodle',
}

# Create new courses
courses = [{
'shortname': 'New Course', # shortname must be unique
'fullname': 'New Course Zikzakmedia',
'categoryid': 1,
#'visible': 1,
'id': 2,
#'maxbytes': 2097152,
#'showreports': 0,
#'startdate': 1314396000,
#'defaultgroupingid': 0,
#'summaryformat': 1,
#'completionstartonenrol': 0,
#'groupmode': 0,
#'numsections': 10,
#'showgrades': 1,
#'enablecompletion': 0,
#'hiddensections': 0,
#'format': 'topics',
#'completionnotify': 0,
#'lang': '',
#'categorysortorder': 10001,
#'timecreated': 1314367091,
#'groupmodeforce': 0,
#'forcetheme': '',
#'summary': u'<p>\ufeff</p>',
#'idnumber': '',
#'newsitems': 5,
#'timemodified': 1314367091
}]
mdl.create_courses(server, courses)

The implemented methods and APIs are:

* create_courses(server, courses)
* get_courses(server)
* create_users(server, users)
* update_users(server, users)
* delete_users(server, users)
* get_users(server, user_ids)
* enrol_users(server, enrols) (include unrol users)
* duplicate_course(server,course)
* get_course_users(server,course)
* update_course(server,course)

For more examples, see examples dir

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for moodle-ws-client, version 0.0.4
Filename, size File type Python version Upload date Hashes
Filename, size moodle-ws-client-0.0.4.tar.gz (4.9 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page