Skip to content

Label

py_moodle.label

Label management module for py-moodle.

Classes:

Name Description
MoodleLabelError

Exception raised for errors in label operations.

Functions:

Name Description
add_label

Creates a new label by calling the generic module creation function.

delete_label

Deletes a label module by calling the generic module deletion function.

update_label

Updates a label's content, name, or visibility by calling the generic module update function.

Attributes

MODULE_NAME module-attribute

MODULE_NAME = 'label'

Classes

MoodleLabelError

Bases: Exception

Exception raised for errors in label operations.

Functions

add_label

add_label(
    session: Session,
    base_url: str,
    sesskey: str,
    course_id: int,
    section_id: int,
    html: str,
    name: str = "Label (via CLI)",
    visible: int = 1,
) -> int

Creates a new label by calling the generic module creation function.

delete_label

delete_label(
    session: Session, base_url: str, sesskey: str, cmid: int
) -> bool

Deletes a label module by calling the generic module deletion function.

update_label

update_label(
    session: Session,
    base_url: str,
    cmid: int,
    html: Optional[str] = None,
    name: Optional[str] = None,
    visible: Optional[int] = None,
) -> bool

Updates a label's content, name, or visibility by calling the generic module update function.