icalendar.config module#

Runtime configuration for icalendar.

icalendar.config.MAX_ALARM_REPEAT: int = 10000#

Cap on additional triggers expanded from a VALARM REPEAT property.

RFC 5545 Section 3.8.6.2 defines REPEAT as an INTEGER data type, which is defined in RFC 5545 Section 3.3.8 as an integer between -2147483648 and 2147483647. A value for REPEAT that is greater than approximately 10_000 can exhaust memory or CPU. The default value of 10_000 is a practical setting, but may be adjusted to specific use cases. Set to -1 to disable the cap, which should be done only for fully trusted input.

Added in version 7.2.1.

icalendar.config.parse_xml(source)[source]#

Parse xml from source.

This wraps xml.etree.ElementTree.parse(). It makes the XML parser configurable.

If you would like to use another XML parser, you can replace this function.

See also

Safe XML parsing

Parameters:

source – A file-like object to with a read method.

Return type:

ElementTree[Element[str]]

Returns:

The parsed XML tree.

Raises:

TypeError – If the wrong type is passed to source.