has_section / get_section

View as MarkdownOpen in Claude

has_section

Check if a section with the given title exists.

Parameters

title
strRequired

Section title to check.

Returns

boolTrue if the section exists, False otherwise.


get_section

Get a section by title for direct manipulation.

Parameters

title
strRequired

Section title to look up.

Returns

Optional[Section] — The POM Section object, or None if not found.

Example

1from signalwire.core.pom_builder import PomBuilder
2
3pom = PomBuilder()
4pom.add_section("Role", body="You are a helpful assistant.")
5
6if pom.has_section("Role"):
7 section = pom.get_section("Role")
8 print(f"Found section: {section.title}")
9
10print(pom.has_section("Missing")) # False