models

class catholic_mass_readings.models.Mass(date, type_, url, title, sections)
date: date | None

Alias for field number 0

property date_str: str

Gets the formatted date

sections: list[Section]

Alias for field number 4

title: str

Alias for field number 3

to_dict() dict[str, Any]

Returns a dictionary representation.

type_: MassType | str | None

Alias for field number 1

url: str

Alias for field number 2

class catholic_mass_readings.models.MassType(*values)
to_url(dt: date) str

Generates a URL for the specified date.

Parameters:

dt (datetime.date) – The mass date.

Returns:

str containing the url.

>>> MassType.DEFAULT.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625.cfm'
>>> MassType.DAWN.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-Dawn.cfm'
>>> MassType.DAY.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-Day.cfm'
>>> MassType.NIGHT.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-Night.cfm'
>>> MassType.VIGIL.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-Vigil.cfm'
>>> MassType.YEARA.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-YearA.cfm'
>>> MassType.YEARB.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-YearB.cfm'
>>> MassType.YEARC.to_url(datetime.date(2025, 4, 6))
'https://bible.usccb.org/bible/readings/040625-YearC.cfm'
class catholic_mass_readings.models.Reading(verses, text)
format(parent: Section) str

Returns a formatted representation of the Reading

Parameters:

parent (Section) – The parent Section of this Reading.

Returns:

str representation of the reading.

property header: str

Gets the header for this reading.

text: str

Alias for field number 1

property title: str | None

Gets the display header for this reading.

to_dict() dict[str, Any]

Returns a Dictionary representation

verses: list[Verse]

Alias for field number 0

with_text(text: str) Reading

Replaces the text with the new text returning a new instance.

class catholic_mass_readings.models.Section(type_, header, readings)
add_alternative(reading: Reading | Iterable[Reading]) Section

Returns a new Section that appends the other alternative Reading

property display_header: str

Returns the human-readable section header.

For READING sections the raw header (e.g. “Reading I”) is translated to a friendly label via SECTION_HEADER_READINGS (e.g. “First Reading”). All other section types return their header unchanged.

property footer: str

Returns the liturgical closing response for this section.

READING sections end with “The word of the Lord.” / “Thanks be to God.” GOSPEL sections end with “The Gospel of the Lord.” / “Praise to you, Lord Jesus Christ.” All other section types return an empty string.

header: str

Alias for field number 1

readings: list[Reading]

Alias for field number 2

to_dict() dict[str, Any]

Returns a Dictionary representation

type_: SectionType

Alias for field number 0

class catholic_mass_readings.models.SectionType(*values)
classmethod from_header(header: str) SectionType

Infers the SectionType from a section header string.

Matching is case-insensitive and keyword-based: “alleluia” → ALLELUIA, “gospel” → GOSPEL, “psalm” → PSALM, “sequence” → SEQUENCE, “reading” → READING, “or” → ALTERNATIVE. Returns UNKNOWN for no match.

Parameters:

header (str) – The raw section header text from the USCCB page.

Returns:

SectionType matching the header keyword, or UNKNOWN.

property is_alternative: bool

Returns True if this is an alternative reading section.

property is_gospel: bool

Returns True if this is a gospel section.

property is_reading: bool

Returns True if this is a standard reading section.

property is_song: bool

Returns True if this is a sung section (Alleluia, Psalm, or Sequence).

property is_unknown: bool

Returns True if this is an unknown section type.

class catholic_mass_readings.models.Verse(text, link, book)
book: str | None

The name of the book

property book_title: str | None

Gets the book title.

The link to the book.

text: str

The reference to the chapter and sentence.

to_dict() dict[str, Any]

Returns a Dictionary representation