icalendar.prop package#
Submodules#
- icalendar.prop.adr module
- icalendar.prop.binary module
- icalendar.prop.boolean module
- icalendar.prop.broken module
- icalendar.prop.cal_address module
vCalAddressvCalAddress.CNvCalAddress.CUTYPEvCalAddress.DELEGATED_FROMvCalAddress.DELEGATED_TOvCalAddress.DIRvCalAddress.LANGUAGEvCalAddress.PARTSTATvCalAddress.ROLEvCalAddress.RSVPvCalAddress.SENT_BYvCalAddress.VALUEvCalAddress.default_valuevCalAddress.emailvCalAddress.examples()vCalAddress.from_ical()vCalAddress.from_jcal()vCalAddress.ical_valuevCalAddress.namevCalAddress.new()vCalAddress.paramsvCalAddress.to_ical()vCalAddress.to_jcal()
- icalendar.prop.categories module
- icalendar.prop.conference module
- icalendar.prop.float module
- icalendar.prop.geo module
- icalendar.prop.image module
- icalendar.prop.inline module
- icalendar.prop.n module
- icalendar.prop.org module
- icalendar.prop.text module
- icalendar.prop.uid module
- icalendar.prop.unknown module
- icalendar.prop.uri module
- icalendar.prop.xml_reference module
Module contents#
This module contains the parser/generators (or coders/encoders if you prefer) for the classes/datatypes that are used in iCalendar:
# This module defines these property value data types and property parameters
4.2 Defined property parameters are:
ALTREP, CN, CUTYPE, DELEGATED-FROM, DELEGATED-TO, DIR, ENCODING, FMTTYPE,
FBTYPE, LANGUAGE, MEMBER, PARTSTAT, RANGE, RELATED, RELTYPE, ROLE, RSVP,
SENT-BY, TZID, VALUE
4.3 Defined value data types are:
BINARY, BOOLEAN, CAL-ADDRESS, DATE, DATE-TIME, DURATION, FLOAT, INTEGER,
PERIOD, RECUR, TEXT, TIME, URI, UTC-OFFSET
iCalendar properties have values. The values are strongly typed. This module defines these types, calling val.to_ical() on them will render them as defined in rfc5545.
If you pass any of these classes a Python primitive, you will have an object that can render itself as iCalendar formatted date.
Property Value Data Types start with a 'v'. they all have an to_ical() and from_ical() method. The to_ical() method generates a text string in the iCalendar format. The from_ical() method can parse this format and return a primitive Python datatype. So it should always be true that:
x == vDataType.from_ical(VDataType(x).to_ical())
These types are mainly used for parsing and file generation. But you can set them directly.
- class icalendar.prop.TimeBase[source]#
Bases:
objectMake classes with a datetime/date comparable.
- property RANGE: RANGE | str | None#
Specify the effective range of recurrence instances from the instance specified by the recurrence identifier specified by the property.
- Description:
This parameter can be specified on a property that specifies a recurrence identifier. The parameter specifies the effective range of recurrence instances that is specified by the property. The effective range is from the recurrence identifier specified by the property. If this parameter is not specified on an allowed property, then the default range is the single instance specified by the recurrence identifier value of the property. The parameter value can only be "THISANDFUTURE" to indicate a range defined by the recurrence identifier and all subsequent instances. The value "THISANDPRIOR" is deprecated by this revision of iCalendar and MUST NOT be generated by applications.
- property RELATED: RELATED | str#
Specify the relationship of the alarm trigger with respect to the start or end of the calendar component.
- Description:
This parameter can be specified on properties that specify an alarm trigger with a "DURATION" value type. The parameter specifies whether the alarm will trigger relative to the start or end of the calendar component. The parameter value START will set the alarm to trigger off the start of the calendar component; the parameter value END will set the alarm to trigger off the end of the calendar component. If the parameter is not specified on an allowable property, then the default is START.
- property TZID: str | None#
Specify the identifier for the time zone definition for a time component in the property value.
- Description:
This parameter MUST be specified on the "DTSTART", "DTEND", "DUE", "EXDATE", and "RDATE" properties when either a DATE-TIME or TIME value type is specified and when the value is neither a UTC or a "floating" time. Refer to the DATE-TIME or TIME value type definition for a description of UTC and "floating time" formats. This property parameter specifies a text value that uniquely identifies the "VTIMEZONE" calendar component to be used when evaluating the time portion of the property. The value of the "TZID" property parameter will be equal to the value of the "TZID" property for the matching time zone definition. An individual "VTIMEZONE" calendar component MUST be specified for each unique "TZID" parameter value specified in the iCalendar object.
The parameter MUST be specified on properties with a DATE-TIME value if the DATE-TIME is not either a UTC or a "floating" time. Failure to include and follow VTIMEZONE definitions in iCalendar objects may lead to inconsistent understanding of the local time at any given location.
The presence of the SOLIDUS character as a prefix, indicates that this "TZID" represents a unique ID in a globally defined time zone registry (when such registry is defined).
Note
This document does not define a naming convention for time zone identifiers. Implementers may want to use the naming conventions defined in existing time zone specifications such as the public-domain TZ database (TZDB). The specification of globally unique time zone identifiers is not addressed by this document and is left for future study.
- ignore_for_equality = {'TZID', 'VALUE'}#
- params: Parameters#
- class icalendar.prop.TypesFactory(*args, **kwargs)[source]#
Bases:
CaselessDictAll Value types defined in RFC 5545 are registered in this factory class.
The value and parameter names don't overlap. So one factory is enough for both kinds.
- from_ical(name, value)[source]#
Decodes a named property or parameter value from an icalendar encoded string to a primitive python type.
- to_ical(name, value)[source]#
Encodes a named value from a primitive python type to an icalendar encoded string.
- types_map = {'ACKNOWLEDGED': 'date-time', 'ACTION': 'text', 'ADR': 'adr', 'ALTREP': 'uri', 'ATTACH': 'uri', 'ATTENDEE': 'cal-address', 'CALSCALE': 'text', 'CATEGORIES': 'categories', 'CLASS': 'text', 'CN': 'text', 'COMMENT': 'text', 'COMPLETED': 'date-time', 'CONCEPT': 'uri', 'CONFERENCE': 'uri', 'CONTACT': 'text', 'CREATED': 'date-time', 'CUTYPE': 'text', 'DELEGATED-FROM': 'cal-address', 'DELEGATED-TO': 'cal-address', 'DESCRIPTION': 'text', 'DIR': 'uri', 'DTEND': 'date-time', 'DTSTAMP': 'date-time', 'DTSTART': 'date-time', 'DUE': 'date-time', 'DURATION': 'duration', 'ENCODING': 'text', 'EXDATE': 'date-time-list', 'EXRULE': 'recur', 'FBTYPE': 'text', 'FMTTYPE': 'text', 'FREEBUSY': 'period', 'GAP': 'duration', 'GEO': 'geo', 'LABEL': 'text', 'LANGUAGE': 'text', 'LAST-MODIFIED': 'date-time', 'LINK': 'uri', 'LINKREL': 'text', 'LOCATION': 'text', 'MEMBER': 'cal-address', 'METHOD': 'text', 'N': 'n', 'ORG': 'org', 'ORGANIZER': 'cal-address', 'PARTSTAT': 'text', 'PERCENT-COMPLETE': 'integer', 'PRIORITY': 'integer', 'PRODID': 'text', 'RANGE': 'text', 'RDATE': 'date-time-list', 'RECURRENCE-ID': 'date-time', 'REFID': 'text', 'REFRESH-INTERVAL': 'duration', 'RELATED': 'text', 'RELATED-TO': 'text', 'RELTYPE': 'text', 'REPEAT': 'integer', 'REQUEST-STATUS': 'text', 'RESOURCES': 'text', 'ROLE': 'text', 'RRULE': 'recur', 'RSVP': 'boolean', 'SENT-BY': 'cal-address', 'SEQUENCE': 'integer', 'SOURCE': 'uri', 'STATUS': 'text', 'SUMMARY': 'text', 'TRANSP': 'text', 'TRIGGER': 'duration', 'TZID': 'text', 'TZNAME': 'text', 'TZOFFSETFROM': 'utc-offset', 'TZOFFSETTO': 'utc-offset', 'TZURL': 'uri', 'UID': 'text', 'URL': 'uri', 'VALUE': 'text', 'VERSION': 'text'}#
- class icalendar.prop.vDDDLists(dt_list, params=None)[source]#
Bases:
objectA list of vDDDTypes values.
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the jCal provided is invalid.
- Return type:
- params: Parameters#
- class icalendar.prop.vDDDTypes(dt, params=None)[source]#
Bases:
TimeBaseA combined Datetime, Date or Duration parser/generator. Their format cannot be confused, and often values can be of either types. So this is practical.
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- classmethod parse_jcal_value(jcal)[source]#
Parse a jCal value.
- Raises:
JCalParsingError -- If the value can't be parsed as either a date, time, date-time, duration, or period.
- Return type:
- property td: timedelta#
Compatibility property returning
self.dt.This class is used to replace different time components. Some of them contain a datetime or date (
.dt). Some of them contain a timedelta (.td). This property allows interoperability.
- class icalendar.prop.vDate(dt, params=None)[source]#
Bases:
TimeBaseDate
- Value Name:
DATE
- Purpose:
This value type is used to identify values that contain a calendar date.
- Format Definition:
This value type is defined by the following notation:
date = date-value date-value = date-fullyear date-month date-mday date-fullyear = 4DIGIT date-month = 2DIGIT ;01-12 date-mday = 2DIGIT ;01-28, 01-29, 01-30, 01-31 ;based on month/year- Description:
If the property permits, multiple "date" values are specified as a COMMA-separated list of values. The format for the value type is based on the [ISO.8601.2004] complete representation, basic format for a calendar date. The textual format specifies a four-digit year, two-digit month, and two-digit day of the month. There are no separator characters between the year, month, and day component text.
Example
The following represents July 14, 1997:
19970714
>>> from icalendar.prop import vDate >>> date = vDate.from_ical('19970714') >>> date.year 1997 >>> date.month 7 >>> date.day 14
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- classmethod parse_jcal_value(jcal)[source]#
Parse a jCal string to a
datetime.datetime.- Raises:
JCalParsingError -- If it can't parse a date.
- Return type:
- class icalendar.prop.vDatetime(dt, /, params=None)[source]#
Bases:
TimeBaseDate-Time
- Value Name:
DATE-TIME
- Purpose:
This value type is used to identify values that specify a precise calendar date and time of day. The format is based on the ISO.8601.2004 complete representation.
- Format Definition:
This value type is defined by the following notation:
date-time = date "T" time date = date-value date-value = date-fullyear date-month date-mday date-fullyear = 4DIGIT date-month = 2DIGIT ;01-12 date-mday = 2DIGIT ;01-28, 01-29, 01-30, 01-31 ;based on month/year time = time-hour time-minute time-second [time-utc] time-hour = 2DIGIT ;00-23 time-minute = 2DIGIT ;00-59 time-second = 2DIGIT ;00-60 time-utc = "Z"The following is the representation of the date-time format.
YYYYMMDDTHHMMSS
- Description:
vDatetime is timezone aware and uses a timezone library. When a vDatetime object is created from an ical string, you can pass a valid timezone identifier. When a vDatetime object is created from a Python
datetimeobject, it uses the tzinfo component, if present. Otherwise a timezone-naive object is created. Be aware that there are certain limitations with timezone naive DATE-TIME components in the icalendar standard.
Example
The following represents March 2, 2021 at 10:15 AM with local time:
>>> from icalendar import vDatetime >>> datetime = vDatetime.from_ical("20210302T101500") >>> datetime.tzname() >>> datetime.year 2021 >>> datetime.minute 15
The following represents March 2, 2021 at 10:15 AM in New York:
>>> datetime = vDatetime.from_ical("20210302T101500", 'America/New_York') >>> datetime.tzname() 'EST'
The following represents March 2, 2021 at 10:15 AM in Berlin:
>>> from zoneinfo import ZoneInfo >>> timezone = ZoneInfo("Europe/Berlin") >>> vDatetime.from_ical("20210302T101500", timezone) datetime.datetime(2021, 3, 2, 10, 15, tzinfo=ZoneInfo(key='Europe/Berlin'))
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- classmethod parse_jcal_value(jcal)[source]#
Parse a jCal string to a
datetime.datetime.- Raises:
JCalParsingError -- If it can't parse a date-time value.
- Return type:
- class icalendar.prop.vDuration(td, /, params=None)[source]#
Bases:
TimeBaseDuration
- Value Name:
DURATION
- Purpose:
This value type is used to identify properties that contain a duration of time.
- Format Definition:
This value type is defined by the following notation:
dur-value = (["+"] / "-") "P" (dur-date / dur-time / dur-week) dur-date = dur-day [dur-time] dur-time = "T" (dur-hour / dur-minute / dur-second) dur-week = 1*DIGIT "W" dur-hour = 1*DIGIT "H" [dur-minute] dur-minute = 1*DIGIT "M" [dur-second] dur-second = 1*DIGIT "S" dur-day = 1*DIGIT "D"
- Description:
If the property permits, multiple "duration" values are specified by a COMMA-separated list of values. The format is based on the [ISO.8601.2004] complete representation basic format with designators for the duration of time. The format can represent nominal durations (weeks and days) and accurate durations (hours, minutes, and seconds). Note that unlike [ISO.8601.2004], this value type doesn't support the "Y" and "M" designators to specify durations in terms of years and months. The duration of a week or a day depends on its position in the calendar. In the case of discontinuities in the time scale, such as the change from standard time to daylight time and back, the computation of the exact duration requires the subtraction or addition of the change of duration of the discontinuity. Leap seconds MUST NOT be considered when computing an exact duration. When computing an exact duration, the greatest order time components MUST be added first, that is, the number of days MUST be added first, followed by the number of hours, number of minutes, and number of seconds.
Example
A duration of 15 days, 5 hours, and 20 seconds would be:
P15DT5H0M20S
A duration of 7 weeks would be:
P7W
>>> from icalendar.prop import vDuration >>> duration = vDuration.from_ical('P15DT5H0M20S') >>> duration datetime.timedelta(days=15, seconds=18020) >>> duration = vDuration.from_ical('P7W') >>> duration datetime.timedelta(days=49)
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- classmethod parse_jcal_value(jcal)[source]#
Parse a jCal string to a
datetime.timedelta.- Raises:
JCalParsingError -- If it can't parse a duration.
- Return type:
- class icalendar.prop.vFrequency(value, encoding='utf-8', /, params: dict[str, Any] | None = None)[source]#
Bases:
strA simple class that catches illegal values.
- frequencies = {'DAILY': 'DAILY', 'HOURLY': 'HOURLY', 'MINUTELY': 'MINUTELY', 'MONTHLY': 'MONTHLY', 'SECONDLY': 'SECONDLY', 'WEEKLY': 'WEEKLY', 'YEARLY': 'YEARLY'}#
- params: Parameters#
- classmethod parse_jcal_value(value)[source]#
Parse a jCal value for vFrequency.
- Raises:
JCalParsingError -- If the value is not a valid frequency.
- Return type:
- class icalendar.prop.vInt(*args, params: dict[str, Any] | None = None, **kwargs)[source]#
Bases:
intInteger
- Value Name:
INTEGER
- Purpose:
This value type is used to identify properties that contain a signed integer value.
- Format Definition:
This value type is defined by the following notation:
integer = (["+"] / "-") 1*DIGIT
- Description:
If the property permits, multiple "integer" values are specified by a COMMA-separated list of values. The valid range for "integer" is -2147483648 to 2147483647. If the sign is not specified, then the value is assumed to be positive.
Example:
1234567890 -1234567890 +1234567890 432109876
>>> from icalendar.prop import vInt >>> integer = vInt.from_ical('1234567890') >>> integer 1234567890 >>> integer = vInt.from_ical('-1234567890') >>> integer -1234567890 >>> integer = vInt.from_ical('+1234567890') >>> integer 1234567890 >>> integer = vInt.from_ical('432109876') >>> integer 432109876
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- classmethod parse_jcal_value(value)[source]#
Parse a jCal value for vInt.
- Raises:
JCalParsingError -- If the value is not an int.
- Return type:
- class icalendar.prop.vMonth(month: str | int, /, params: dict[str, Any] | None = None)[source]#
Bases:
intThe number of the month for recurrence.
In RFC 5545, this is just an int. In RFC 7529, this can be followed by L to indicate a leap month.
>>> from icalendar import vMonth >>> vMonth(1) # first month January vMonth('1') >>> vMonth("5L") # leap month in Hebrew calendar vMonth('5L') >>> vMonth(1).leap False >>> vMonth("5L").leap True
Definition from RFC:
type-bymonth = element bymonth { xsd:positiveInteger | xsd:string }- params: Parameters#
- classmethod parse_jcal_value(value)[source]#
Parse a jCal value for vMonth.
- Raises:
JCalParsingError -- If the value is not a valid month.
- Return type:
- class icalendar.prop.vPeriod(per, params=None)[source]#
Bases:
TimeBasePeriod of Time
- Value Name:
PERIOD
- Purpose:
This value type is used to identify values that contain a precise period of time.
- Format Definition:
This value type is defined by the following notation:
period = period-explicit / period-start period-explicit = date-time "/" date-time ; [ISO.8601.2004] complete representation basic format for a ; period of time consisting of a start and end. The start MUST ; be before the end. period-start = date-time "/" dur-value ; [ISO.8601.2004] complete representation basic format for a ; period of time consisting of a start and positive duration ; of time.
- Description:
If the property permits, multiple "period" values are specified by a COMMA-separated list of values. There are two forms of a period of time. First, a period of time is identified by its start and its end. This format is based on the [ISO.8601.2004] complete representation, basic format for "DATE- TIME" start of the period, followed by a SOLIDUS character followed by the "DATE-TIME" of the end of the period. The start of the period MUST be before the end of the period. Second, a period of time can also be defined by a start and a positive duration of time. The format is based on the [ISO.8601.2004] complete representation, basic format for the "DATE-TIME" start of the period, followed by a SOLIDUS character, followed by the [ISO.8601.2004] basic format for "DURATION" of the period.
Example
The period starting at 18:00:00 UTC, on January 1, 1997 and ending at 07:00:00 UTC on January 2, 1997 would be:
19970101T180000Z/19970102T070000Z
The period start at 18:00:00 on January 1, 1997 and lasting 5 hours and 30 minutes would be:
19970101T180000Z/PT5H30M
>>> from icalendar.prop import vPeriod >>> period = vPeriod.from_ical('19970101T180000Z/19970102T070000Z') >>> period = vPeriod.from_ical('19970101T180000Z/PT5H30M')
- property FBTYPE: FBTYPE | str#
Specify the free or busy time type.
- Description:
This parameter specifies the free or busy time type. The value FREE indicates that the time interval is free for scheduling. The value BUSY indicates that the time interval is busy because one or more events have been scheduled for that interval. The value BUSY-UNAVAILABLE indicates that the time interval is busy and that the interval can not be scheduled. The value BUSY-TENTATIVE indicates that the time interval is busy because one or more events have been tentatively scheduled for that interval. If not specified on a property that allows this parameter, the default is BUSY. Applications MUST treat x-name and iana-token values they don't recognize the same way as they would the BUSY value.
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- property dt#
Make this cooperate with the other vDDDTypes.
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- class icalendar.prop.vRecur(*args, params=None, **kwargs)[source]#
Bases:
CaselessDictRecurrence definition.
- Property Name:
RRULE
- Purpose:
This property defines a rule or repeating pattern for recurring events, to-dos, journal entries, or time zone definitions.
- Value Type:
RECUR
- Property Parameters:
IANA and non-standard property parameters can be specified on this property.
- Conformance:
This property can be specified in recurring "VEVENT", "VTODO", and "VJOURNAL" calendar components as well as in the "STANDARD" and "DAYLIGHT" sub-components of the "VTIMEZONE" calendar component, but it SHOULD NOT be specified more than once. The recurrence set generated with multiple "RRULE" properties is undefined.
- Description:
The recurrence rule, if specified, is used in computing the recurrence set. The recurrence set is the complete set of recurrence instances for a calendar component. The recurrence set is generated by considering the initial "DTSTART" property along with the "RRULE", "RDATE", and "EXDATE" properties contained within the recurring component. The "DTSTART" property defines the first instance in the recurrence set. The "DTSTART" property value SHOULD be synchronized with the recurrence rule, if specified. The recurrence set generated with a "DTSTART" property value not synchronized with the recurrence rule is undefined. The final recurrence set is generated by gathering all of the start DATE-TIME values generated by any of the specified "RRULE" and "RDATE" properties, and then excluding any start DATE-TIME values specified by "EXDATE" properties. This implies that start DATE- TIME values specified by "EXDATE" properties take precedence over those specified by inclusion properties (i.e., "RDATE" and "RRULE"). Where duplicate instances are generated by the "RRULE" and "RDATE" properties, only one recurrence is considered. Duplicate instances are ignored.
The "DTSTART" property specified within the iCalendar object defines the first instance of the recurrence. In most cases, a "DTSTART" property of DATE-TIME value type used with a recurrence rule, should be specified as a date with local time and time zone reference to make sure all the recurrence instances start at the same local time regardless of time zone changes.
If the duration of the recurring component is specified with the "DTEND" or "DUE" property, then the same exact duration will apply to all the members of the generated recurrence set. Else, if the duration of the recurring component is specified with the "DURATION" property, then the same nominal duration will apply to all the members of the generated recurrence set and the exact duration of each recurrence instance will depend on its specific start time. For example, recurrence instances of a nominal duration of one day will have an exact duration of more or less than 24 hours on a day where a time zone shift occurs. The duration of a specific recurrence may be modified in an exception component or simply by using an "RDATE" property of PERIOD value type.
Examples
The following RRULE specifies daily events for 10 occurrences.
RRULE:FREQ=DAILY;COUNT=10
Below, we parse the RRULE ical string.
>>> from icalendar.prop import vRecur >>> rrule = vRecur.from_ical('FREQ=DAILY;COUNT=10') >>> rrule vRecur({'FREQ': ['DAILY'], 'COUNT': [10]})
You can choose to add an rrule to an
icalendar.cal.Eventoricalendar.cal.Todo.>>> from icalendar import Event >>> event = Event() >>> event.add('RRULE', 'FREQ=DAILY;COUNT=10') >>> event.rrules [vRecur({'FREQ': ['DAILY'], 'COUNT': [10]})]
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- canonical_order = ('RSCALE', 'FREQ', 'UNTIL', 'COUNT', 'INTERVAL', 'BYSECOND', 'BYMINUTE', 'BYHOUR', 'BYDAY', 'BYWEEKDAY', 'BYMONTHDAY', 'BYYEARDAY', 'BYWEEKNO', 'BYMONTH', 'BYSETPOS', 'WKST', 'SKIP')#
- frequencies = ['SECONDLY', 'MINUTELY', 'HOURLY', 'DAILY', 'WEEKLY', 'MONTHLY', 'YEARLY']#
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- jcal_not_a_list = {'COUNT', 'FREQ', 'INTERVAL', 'RSCALE', 'SKIP', 'UNTIL', 'WKST'}#
- params: Parameters#
- types = {'BYDAY': <class 'icalendar.prop.vWeekday'>, 'BYHOUR': <class 'icalendar.prop.vInt'>, 'BYMINUTE': <class 'icalendar.prop.vInt'>, 'BYMONTH': <class 'icalendar.prop.vMonth'>, 'BYMONTHDAY': <class 'icalendar.prop.vInt'>, 'BYSECOND': <class 'icalendar.prop.vInt'>, 'BYSETPOS': <class 'icalendar.prop.vInt'>, 'BYWEEKDAY': <class 'icalendar.prop.vWeekday'>, 'BYWEEKNO': <class 'icalendar.prop.vInt'>, 'BYYEARDAY': <class 'icalendar.prop.vInt'>, 'COUNT': <class 'icalendar.prop.vInt'>, 'FREQ': <class 'icalendar.prop.vFrequency'>, 'INTERVAL': <class 'icalendar.prop.vInt'>, 'RSCALE': <class 'icalendar.prop.text.vText'>, 'SKIP': <enum 'vSkip'>, 'UNTIL': <class 'icalendar.prop.vDDDTypes'>, 'WKST': <class 'icalendar.prop.vWeekday'>}#
- class icalendar.prop.vSkip(*values)[source]#
-
Skip values for RRULE.
These are defined in RFC 7529.
OMIT is the default value.
Examples:
>>> from icalendar import vSkip >>> vSkip.OMIT vSkip('OMIT') >>> vSkip.FORWARD vSkip('FORWARD') >>> vSkip.BACKWARD vSkip('BACKWARD')
- BACKWARD = vText(b'BACKWARD')#
- FORWARD = vText(b'FORWARD')#
- OMIT = vText(b'OMIT')#
- encoding#
- params: Parameters#
- classmethod parse_jcal_value(value)[source]#
Parse a jCal value for vSkip.
- Raises:
JCalParsingError -- If the value is not a valid skip value.
- Return type:
- class icalendar.prop.vTime(*args, params=None)[source]#
Bases:
TimeBaseTime
- Value Name:
TIME
- Purpose:
This value type is used to identify values that contain a time of day.
- Format Definition:
This value type is defined by the following notation:
time = time-hour time-minute time-second [time-utc] time-hour = 2DIGIT ;00-23 time-minute = 2DIGIT ;00-59 time-second = 2DIGIT ;00-60 ;The "60" value is used to account for positive "leap" seconds. time-utc = "Z"
- Description:
If the property permits, multiple "time" values are specified by a COMMA-separated list of values. No additional content value encoding (i.e., BACKSLASH character encoding, see vText) is defined for this value type.
The "TIME" value type is used to identify values that contain a time of day. The format is based on the [ISO.8601.2004] complete representation, basic format for a time of day. The text format consists of a two-digit, 24-hour of the day (i.e., values 00-23), two-digit minute in the hour (i.e., values 00-59), and two-digit seconds in the minute (i.e., values 00-60). The seconds value of 60 MUST only be used to account for positive "leap" seconds. Fractions of a second are not supported by this format.
In parallel to the "DATE-TIME" definition above, the "TIME" value type expresses time values in three forms:
The form of time with UTC offset MUST NOT be used. For example, the following is not valid for a time value:
230000-0800 ;Invalid time format
FORM #1 LOCAL TIME
The local time form is simply a time value that does not contain the UTC designator nor does it reference a time zone. For example, 11:00 PM:
230000
Time values of this type are said to be "floating" and are not bound to any time zone in particular. They are used to represent the same hour, minute, and second value regardless of which time zone is currently being observed. For example, an event can be defined that indicates that an individual will be busy from 11:00 AM to 1:00 PM every day, no matter which time zone the person is in. In these cases, a local time can be specified. The recipient of an iCalendar object with a property value consisting of a local time, without any relative time zone information, SHOULD interpret the value as being fixed to whatever time zone the "ATTENDEE" is in at any given moment. This means that two "Attendees", may participate in the same event at different UTC times; floating time SHOULD only be used where that is reasonable behavior.
In most cases, a fixed time is desired. To properly communicate a fixed time in a property value, either UTC time or local time with time zone reference MUST be specified.
The use of local time in a TIME value without the "TZID" property parameter is to be interpreted as floating time, regardless of the existence of "VTIMEZONE" calendar components in the iCalendar object.
FORM #2: UTC TIME
UTC time, or absolute time, is identified by a LATIN CAPITAL LETTER Z suffix character, the UTC designator, appended to the time value. For example, the following represents 07:00 AM UTC:
070000Z
The "TZID" property parameter MUST NOT be applied to TIME properties whose time values are specified in UTC.
FORM #3: LOCAL TIME AND TIME ZONE REFERENCE
The local time with reference to time zone information form is identified by the use the "TZID" property parameter to reference the appropriate time zone definition.
- Example:
The following represents 8:30 AM in New York in winter, five hours behind UTC, in each of the three formats:
083000 133000Z TZID=America/New_York:083000
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- params: Parameters#
- classmethod parse_jcal_value(jcal)[source]#
Parse a jCal string to a
datetime.time.- Raises:
JCalParsingError -- If it can't parse a time.
- Return type:
- class icalendar.prop.vUTCOffset(td, /, params=None)[source]#
Bases:
objectUTC Offset
- Value Name:
UTC-OFFSET
- Purpose:
This value type is used to identify properties that contain an offset from UTC to local time.
- Format Definition:
This value type is defined by the following notation:
utc-offset = time-numzone time-numzone = ("+" / "-") time-hour time-minute [time-second]- Description:
The PLUS SIGN character MUST be specified for positive UTC offsets (i.e., ahead of UTC). The HYPHEN-MINUS character MUST be specified for negative UTC offsets (i.e., behind of UTC). The value of "-0000" and "-000000" are not allowed. The time-second, if present, MUST NOT be 60; if absent, it defaults to zero.
- Example:
The following UTC offsets are given for standard time for New York (five hours behind UTC) and Geneva (one hour ahead of UTC):
-0500 +0100
>>> from icalendar.prop import vUTCOffset >>> utc_offset = vUTCOffset.from_ical('-0500') >>> utc_offset datetime.timedelta(days=-1, seconds=68400) >>> utc_offset = vUTCOffset.from_ical('+0100') >>> utc_offset datetime.timedelta(seconds=3600)
- property VALUE: str#
The VALUE parameter or the default.
- Purpose:
VALUE explicitly specify the value type format for a property value.
- Description:
This parameter specifies the value type and format of the property value. The property values MUST be of a single value type. For example, a "RDATE" property cannot have a combination of DATE-TIME and TIME value types.
If the property's value is the default value type, then this parameter need not be specified. However, if the property's default value type is overridden by some other allowable value type, then this parameter MUST be specified.
Applications MUST preserve the value data for
x-nameandiana-tokenvalues that they don't recognize without attempting to interpret or parse the value data.
- Returns:
The VALUE parameter or the default.
Examples
The VALUE defaults to the name of the property. Note that it is case-insensitive but always uppercase.
>>> from icalendar import vBoolean >>> b = vBoolean(True) >>> b.VALUE 'BOOLEAN'
Setting the VALUE parameter of a typed property usually does not make sense. For convenience, using this property, the value will be converted to an uppercase string. If you have some custom property, you might use it like this:
>>> from icalendar import vUnknown, Event >>> v = vUnknown("Some property text.") >>> v.VALUE = "x-type" # lower case >>> v.VALUE 'X-TYPE' >>> event = Event() >>> event.add("x-prop", v) >>> print(event.to_ical()) BEGIN:VEVENT X-PROP;VALUE=X-TYPE:Some property text. END:VEVENT
- format(divider='')[source]#
Represent the value with a possible divider.
>>> from icalendar import vUTCOffset >>> from datetime import timedelta >>> utc_offset = vUTCOffset(timedelta(hours=-5)) >>> utc_offset.format() '-0500' >>> utc_offset.format(divider=':') '-05:00'
- Return type:
- classmethod from_jcal(jcal_property)[source]#
Parse jCal from RFC 7265.
- Parameters:
jcal_property (
list) -- The jCal property to parse.- Raises:
JCalParsingError -- If the provided jCal is invalid.
- Return type:
- ignore_exceptions = False#
- params: Parameters#
- class icalendar.prop.vWeekday(value, encoding='utf-8', /, params: dict[str, Any] | None = None)[source]#
Bases:
strEither a
weekdayor aweekdaynum.>>> from icalendar import vWeekday >>> vWeekday("MO") # Simple weekday 'MO' >>> vWeekday("2FR").relative # Second friday 2 >>> vWeekday("2FR").weekday 'FR' >>> vWeekday("-1SU").relative # Last Sunday -1
Definition from RFC 5545 Section 3.3.10:
weekdaynum = [[plus / minus] ordwk] weekday plus = "+" minus = "-" ordwk = 1*2DIGIT ;1 to 53 weekday = "SU" / "MO" / "TU" / "WE" / "TH" / "FR" / "SA" ;Corresponding to SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, ;FRIDAY, and SATURDAY days of the week.
- params: Parameters#
- classmethod parse_jcal_value(value)[source]#
Parse a jCal value for vWeekday.
- Raises:
JCalParsingError -- If the value is not a valid weekday.
- Return type:
- relative#
- week_days = {'FR': 5, 'MO': 1, 'SA': 6, 'SU': 0, 'TH': 4, 'TU': 2, 'WE': 3}#
- weekday#