py-moodle¶
A CLI to manage Moodle via AJAX sessions and web services.
Usage:
Options:
-e, --env TEXT: Environment to use: local | staging | prod (also respects MOODLE_ENV) [default: local]--install-completion: Install completion for the current shell.--show-completion: Show completion for the current shell, to copy it or customize the installation.--help: Show this message and exit.
Commands:
courses: Manage courses: list, show, create, delete.categories: Manage course categories: list, create,...sections: Manage course sections: list, show,...modules: Manage course modules...users: Manage Moodle users: list, create, delete.admin: Moodle site administration tasks.folders: Manage folder modules: create, delete, and...pages: Manage page modules: create and delete...resources: Manage resource modules: create and delete...urls: Manage URL modules: create and delete...site: Get site information.
py-moodle courses¶
Manage courses: list, show, create, delete.
Usage:
Options:
--help: Show this message and exit.
Commands:
list: Lists all available courses.show: Shows a detailed summary of a specific...create: Creates a new course.delete: Deletes a course by its ID.
py-moodle courses list¶
Lists all available courses.
Usage:
Options:
--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle courses show¶
Shows a detailed summary of a specific course, including its sections and modules.
Usage:
Arguments:
COURSE_ID: ID of the course to show. [required]
Options:
--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle courses create¶
Creates a new course.
Usage:
Options:
--fullname TEXT: Full name for the new course. [required]--shortname TEXT: Short name for the new course. [required]--categoryid INTEGER: Category ID for the new course. [default: 1]--visible INTEGER: 1 for visible, 0 for hidden. [default: 1]--summary TEXT: Course summary.--help: Show this message and exit.
py-moodle courses delete¶
Deletes a course by its ID.
Usage:
Arguments:
COURSE_ID: ID of the course to delete. [required]
Options:
--force: Delete without asking for confirmation.--help: Show this message and exit.
py-moodle categories¶
Manage course categories: list, create, delete.
Usage:
Options:
--help: Show this message and exit.
Commands:
list: Lists all available course categories.create: Creates a new course category.delete: Deletes a course category by its ID.
py-moodle categories list¶
Lists all available course categories.
Usage:
Options:
--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle categories create¶
Creates a new course category. This operation uses a session key (sesskey) and does not require a webservice token.
Usage:
Options:
--name TEXT: Name for the new category. [required]--parent-id INTEGER: Parent category ID (default: 0 for top level). [default: 0]--help: Show this message and exit.
py-moodle categories delete¶
Deletes a course category by its ID. The category must be empty. This operation uses a session key (sesskey).
Usage:
Arguments:
CATEGORY_ID: ID of the category to delete. [required]
Options:
--force: Delete without a confirmation prompt.--help: Show this message and exit.
py-moodle sections¶
Manage course sections: list, show, create, delete.
Usage:
Options:
--help: Show this message and exit.
Commands:
list: Lists a summary of all sections in a...show: Shows detailed information of a specific...create: Creates a new section at the end of a course.delete: Deletes a specific section by its ID.
py-moodle sections list¶
Lists a summary of all sections in a specific course.
Usage:
Options:
--course-id INTEGER: ID of the course to list sections from. [required]--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle sections show¶
Shows detailed information of a specific section, including its modules.
Usage:
Arguments:
SECTION_ID: ID of the section to show. [required]
Options:
--course-id INTEGER: ID of the course the section belongs to. [required]--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle sections create¶
Creates a new section at the end of a course.
Usage:
Options:
--course-id INTEGER: ID of the course where to create the section. [required]--help: Show this message and exit.
py-moodle sections delete¶
Deletes a specific section by its ID.
Usage:
Arguments:
SECTION_ID: ID of the section to delete. [required]
Options:
--course-id INTEGER: ID of the course the section belongs to. [required]--help: Show this message and exit.
py-moodle modules¶
Manage course modules (resources/activities) like labels, SCORMs, etc.
Usage:
Options:
--help: Show this message and exit.
Commands:
delete: Deletes any module (label, SCORM, folder,...show: Shows detailed information for a specific...list-types: Lists all available module types...add: Add a new module to a course.edit: Edit existing course modules (labels,...
py-moodle modules delete¶
Deletes any module (label, SCORM, folder, etc.) by its ID. This uses the centralized delete function from the library.
Usage:
Arguments:
CMID: ID of the module (cmid) to delete. [required]
Options:
--help: Show this message and exit.
py-moodle modules show¶
Shows detailed information for a specific module.
Usage:
Arguments:
CMID: ID of the module (cmid) to show. [required]
Options:
--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle modules list-types¶
Lists all available module types (activities/resources) that can be added to a course.
Usage:
Options:
--course-id INTEGER: Course ID to check available modules for. Defaults to 1. [default: 1]--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle modules add¶
Add a new module to a course.
Usage:
Options:
--help: Show this message and exit.
Commands:
label: Adds a new label to a course section.scorm: Adds a new SCORM package to a course section.assign: Adds a new assignment to a course section.
py-moodle modules add label¶
Adds a new label to a course section.
Usage:
Options:
--course-id INTEGER: ID of the course to add the label to. [required]--section-id INTEGER: ID of the section to add the label to. [required]--html TEXT: HTML content of the label. [required]--name TEXT: Internal name for the label. [default: Label (from CLI)]--help: Show this message and exit.
py-moodle modules add scorm¶
Adds a new SCORM package to a course section.
Usage:
Options:
--course-id INTEGER: ID of the course to add the SCORM to. [required]--section-id INTEGER: ID of the section to add the SCORM to. [required]--name TEXT: Name of the SCORM package. [required]--file FILENAME: Path to the SCORM package .zip file. [required]--intro TEXT: Introduction or description for the SCORM.--help: Show this message and exit.
py-moodle modules add assign¶
Adds a new assignment to a course section.
Usage:
Options:
--course-id INTEGER: ID of the course to add the assignment to. [required]--section-id INTEGER: ID of the section to add the assignment to. [required]--name TEXT: Name of the new assignment. [required]--intro TEXT: Introduction or description for the assignment (HTML supported).--help: Show this message and exit.
py-moodle modules edit¶
Edit existing course modules (labels, SCORMs, etc.)
Usage:
Options:
--help: Show this message and exit.
Commands:
label: Edits an existing label module.name: Edits the name of any module (label,...
py-moodle modules edit label¶
Edits an existing label module.
Usage:
Arguments:
CMID: ID of the label module to edit. [required]
Options:
--html TEXT: New HTML content for the label.--name TEXT: New internal name for the label.--visible INTEGER: Set visibility (1 for visible, 0 for hidden).--help: Show this message and exit.
py-moodle modules edit name¶
Edits the name of any module (label, assign, SCORM, etc.).
Usage:
Arguments:
CMID: ID of the module (cmid) to rename. [required]
Options:
-n, --name TEXT: The new name for the module. [required]--help: Show this message and exit.
py-moodle users¶
Manage Moodle users: list, create, delete.
Usage:
Options:
--help: Show this message and exit.
Commands:
list: Lists users enrolled in a specific course.create: Creates a new user in Moodle.delete: Deletes a user from Moodle by their ID.
py-moodle users list¶
Lists users enrolled in a specific course.
Usage:
Options:
--course-id INTEGER: ID of the course to list users from. [required]--output [table|json|yaml]: Output format: table, json, or yaml. [default: table]--help: Show this message and exit.
py-moodle users create¶
Creates a new user in Moodle.
Usage:
Options:
--username TEXT: Username (must be unique). [required]--password TEXT: Password (must meet site policy). [required]--firstname TEXT: First name. [required]--lastname TEXT: Last name. [required]--email TEXT: Email address (must be unique). [required]--help: Show this message and exit.
py-moodle users delete¶
Deletes a user from Moodle by their ID.
Usage:
Arguments:
USER_ID: ID of the user to delete. [required]
Options:
--force: Delete without asking for confirmation.--help: Show this message and exit.
py-moodle admin¶
Moodle site administration tasks.
Usage:
Options:
--help: Show this message and exit.
Commands:
enable-webservice: Activates a web service in Moodle.
py-moodle admin enable-webservice¶
Activates a web service in Moodle. Requires administrator permissions.
Usage:
Options:
--service-id INTEGER: Web service ID to activate (default: 1 for 'Moodle mobile app'). [default: 1]--help: Show this message and exit.
py-moodle folders¶
Manage folder modules: create, delete, and manage their content.
Usage:
Options:
--help: Show this message and exit.
Commands:
add: Adds a new folder to a course section,...delete: Deletes a folder module from a course.list-content: Lists the files and subdirectories inside...add-file: Adds a file to an existing folder.delete-file: Deletes a file from an existing folder.rename-file: Renames a file inside an existing folder.
py-moodle folders add¶
Adds a new folder to a course section, optionally with initial files.
Usage:
Options:
--course-id INTEGER: ID of the course to add the folder to. [required]--section-id INTEGER: ID of the section to add the folder to. [required]--name TEXT: Name of the new folder. [required]--intro TEXT: Introduction or description for the folder (HTML supported).--file FILENAME: Path to a file to include. Can be used multiple times.--help: Show this message and exit.
py-moodle folders delete¶
Deletes a folder module from a course.
Usage:
Arguments:
CMID: ID of the folder module (cmid) to delete. [required]
Options:
-f, --force: Delete without confirmation.--help: Show this message and exit.
py-moodle folders list-content¶
Lists the files and subdirectories inside a folder.
Usage:
Arguments:
CMID: ID of the folder module (cmid) to inspect. [required]
Options:
--help: Show this message and exit.
py-moodle folders add-file¶
Adds a file to an existing folder.
Usage:
Options:
--cmid INTEGER: ID of the folder to add the file to. [required]--file FILENAME: Path of the local file to upload. [required]--subfolder TEXT: Path to the subfolder inside the Moodle folder (e.g., '/scorms/'). Must start and end with '/'. [default: /]--help: Show this message and exit.
py-moodle folders delete-file¶
Deletes a file from an existing folder.
Usage:
Options:
--cmid INTEGER: ID of the folder containing the file. [required]--filename TEXT: Name of the file to delete from the folder. [required]-f, --force: Delete without confirmation.--help: Show this message and exit.
py-moodle folders rename-file¶
Renames a file inside an existing folder.
Usage:
Options:
--cmid INTEGER: ID of the folder containing the file. [required]--old-name TEXT: The current name of the file. [required]--new-name TEXT: The new name for the file. [required]--help: Show this message and exit.
py-moodle pages¶
Manage page modules: create and delete HTML pages.
Usage:
Options:
--help: Show this message and exit.
Commands:
add: Add a new page module with HTML content to...delete: Delete a page module from a course.
py-moodle pages add¶
Add a new page module with HTML content to a course section.
Usage:
Options:
--course-id INTEGER: ID of the course to add the page to. [required]--section-id INTEGER: ID of the section to add the page to. [required]--name TEXT: Name/title of the page. [required]--file FILENAME: Path to a file containing the HTML content. [required]--intro TEXT: Introduction or description for the page.--help: Show this message and exit.
py-moodle pages delete¶
Delete a page module from a course.
Usage:
Arguments:
CMID: ID of the page module (cmid) to delete. [required]
Options:
-f, --force: Delete without confirmation.--help: Show this message and exit.
py-moodle resources¶
Manage resource modules: create and delete single-file resources.
Usage:
Options:
--help: Show this message and exit.
Commands:
add: Add a new resource (single file) to a...delete: Delete a resource module from a course.
py-moodle resources add¶
Add a new resource (single file) to a course section.
Usage:
Options:
--course-id INTEGER: ID of the course to add the resource to. [required]--section-id INTEGER: ID of the section to add the resource to. [required]--name TEXT: Name/title of the resource. [required]--file FILENAME: Path to the file to upload. [required]--intro TEXT: Introduction or description for the resource.--help: Show this message and exit.
py-moodle resources delete¶
Delete a resource module from a course.
Usage:
Arguments:
CMID: ID of the resource module (cmid) to delete. [required]
Options:
-f, --force: Delete without confirmation.--help: Show this message and exit.
py-moodle urls¶
Manage URL modules: create and delete external links.
Usage:
Options:
--help: Show this message and exit.
Commands:
add: Add a new URL module to a course section.delete: Delete a URL module from a course.
py-moodle urls add¶
Add a new URL module to a course section.
Usage:
Options:
--course-id INTEGER: ID of the course to add the URL to. [required]--section-id INTEGER: ID of the section to add the URL to. [required]--name TEXT: Name/title of the URL. [required]--url TEXT: The external URL to link. [required]--intro TEXT: Introduction or description.--help: Show this message and exit.
py-moodle urls delete¶
Delete a URL module from a course.
Usage:
Arguments:
CMID: ID of the URL module (cmid) to delete. [required]
Options:
-f, --force: Delete without confirmation.--help: Show this message and exit.
py-moodle site¶
Get site information.
Usage:
Options:
--help: Show this message and exit.
Commands:
info: Get site info.
py-moodle site info¶
Get site info.
Usage:
Options:
--json: Output as JSON.--help: Show this message and exit.