icalendar.prop.request_status module#

vRequestStatus is a subclass of vText with convenience methods.

class icalendar.prop.request_status.vRequestStatus(value, encoding='utf-8', /, params=None)[source]#

Bases: vText

A text specifically for REQUEST-STATUS.

See RFC 5545 Section 3.8.8.3, RFC 6321 Appendix A in subsection 3.8.8.3 Request Status and, RFC 7265 Section 3.4.1.2.

Examples

The attributes of a valid request status return the parsed data.

>>> from icalendar.prop import vRequestStatus
>>> r = vRequestStatus("2.0;Success")
>>> r.code
(2, 0)
>>> r.description
'Success'
>>> r.data is None
True

An invalid code is indicated by an empty tuple and an empty description.

>>> r = vRequestStatus("2.10;invalid")
>>> r.code
()
>>> r.description
''
>>> r.data is None
True
property code: tuple[int, int] | tuple[int, int, int] | tuple[()]#

Return the status code as a tuple.

Returns:

A tuple of integers or () if the status code could not be parsed.

property code_string: str#

Return the status code as a string.

Returns:

The status string or "" if the request status could not be parsed.

property data: str | None#

Return the data of the request status.

Returns:

The data of the request status or None.

property description: str#

Return the description of the request status.

Returns:

The description of the request status or "" if the request status could not be parsed.

encoding#
classmethod examples()[source]#

Examples of vRequestStatus.

Return type:

list[Self]

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:

Self

classmethod from_xcal(xml)[source]#

Parse xCal from RFC 6321.

Parameters:

xml (XCalParser | ElementAdapter | Element) – The XML to parse or a parser.

Raises:

XCalParsingError – If the provided xCal is invalid.

Return type:

VProp

classmethod new(code, description='', data=None, *, params=None, validate=True)[source]#

Create a new request status object.

Parameters:
  • code (tuple[int, int] | tuple[int, int, int] | str) – The status code.

  • description (str) – The description of the request status.

  • data (str | None) – The data of the request status.

  • validate (bool) – Turn validation for the code string on and off. code tuples are always validated.

Raises:
Return type:

Self

Returns:

A new request status object.

params: Parameters#
to_jcal(name)[source]#

The jCal representation of this property according to RFC 7265.

Return type:

list

to_xcal(element)[source]#

Add the xCal representation of this property according to RFC 6321.

Return type:

None