CalDAV Class

Properties   Methods   Events   Configuration Settings   Errors  

The CalDAV Class implements an easy-to-use interface to the Calendaring Extensions to the Web Distributed Authoring and Versioning protocol (WebDAV). In this manner the CalDAV protocol specifies a standard way of accessing, managing, and sharing calendaring and scheduling information based on the iCalendar format.

Syntax

class ipworks.CalDAV

Remarks

The CalDAV Class supports both plaintext and SSL/TLS connections. When connecting over SSL/TLS the on_ssl_server_authentication event allows you to check the server identity and other security attributes. The on_ssl_status event provides information about the SSL handshake. Additional SSL related settings are also supported via the config method.

The class allows remote management of calendar events and collections of events (the calendar itself), including creation, deletion, listing, copying, and moving. Resource locking is also supported.

The get_calendar_report method will list the event resources contained in the calendar, and the report_filter can be used to limit the results returned. The on_event_details event will be fired for each matching calendar resource. You may also request a report containing a list of times that the owner is free or busy using the get_free_busy_report. The on_free_busy event will fire for each entry received, and the data fired in the event will also be stored in the free_busy property.

Single events can be added to a calendar (or updated) using the put_calendar_event method, and can be retrieved via the get_calendar_event method. Events may be copied or moved with the copy_calendar_event and move_calendar_event.

depth is used to determine which resources or properties are retrieved from the server. A depth of ResourceOnly will return only the resource associated with ResourceURI, or its properties. A depth of Infinity will return all resources contained within hierarchy, or their collective properties.

Note: Some servers (such as IIS 7.5) may not support a depth of Infinity by default and may return a HTTP 403 Forbidden response.

The following properties are used when creating a request with put_calendar_event or export_ics, and will be filled after calling get_calendar_event or import_ics. These will also be available from inside the on_event_details event, which is fired for each event received from the CalDAV server in response to a get_calendar_report.

Each method that acts on the calendar takes a ResourceURI parameter, which points to either an event resource or to the calendar itself. Event resources have a URI that ends with a filename and the ".ics" extension. Calendar resources end in a directory path. The following methods all act on events, and thus their ResourceURI parameters must terminate in a filename with the ".ics" extension:

These methods all act upon the calendar collection resource (the calendar itself): The lock_calendar and un_lock_calendar methods may operate on individual events or on the whole calendar.

There is no standard format for resource URIs. Google for instance, uses "https://www.google.com/calendar/dav/" plus your email address to access the default calendar. So "https://www.google.com/calendar/dav/username@gmail.com/" is the base URI for the default calendar. If you have multiple calendars, replace the email address portion above with the Id of the calendar, plus "@group.calendar.google.com/". For instance: "https://www.google.com/calendar/dav/ev3nkr4ua83jej7q32oumn5eeo@group.calendar.google.com/". For Google, calendar events are stored in the "/events/" path. To retrieve a report on a calendar, you'd add "/events/" to one of the above paths. For example:

  CalDAV.GetCalendarReport("https://www.google.com/calendar/dav/username@gmail.com/events/");
Leaving the "/events/" out of the URI will result in an HTTP protocol error: 405 Method not allowed.

To add or retrieve an event, add the UID of the event you're creating or retrieving plus ".ics" to the path. Note that when putting an event with the put_calendar_event method, if the resourceURI and the UID do not match Google will create the event using the UID stored in the uid property. The actual location of will be newly added event will be returned in a "Location" header. This is the resource URI you must use to retrieve the event with get_calendar_event. For example:

  CalDAV.UID = "1234567890";
  CalDAV.PutCalendarEvent("https://www.google.com/calendar/dav/username@gmail.com/events/1234567890.ics");

Yahoo uses a different format for CalDAV access. Yahoo's ResourceURIs always start with "https://caldav.calendar.yahoo.com/dav/" plus your user name, plus "/Calendar/" plus the name of your calendar. For instance: "https://caldav.calendar.yahoo.com/dav/username/Calendar/Your_Name" for the default calendar. (Yahoo uses your name to create the default calendar). When using the create_calendar event to create a new calendar, replace "Your_Name" in the URI with the desired name of your new calendar. Event resources are located directly under the "/Calendar/Calendar_Name/" path. Like Google, the UID and filename portion of the resource URI must match, but Yahoo will actually return an HTTP protocol error if they differ. The examples below show a few possible transactions:

  CalDAVS1.User = "username";
  CalDAVS1.Password = "password";
  
  CalDAV.DisplayName = "My Hockey Calendar";
  CalDAV.CreateCalendar("https://caldav.calendar.yahoo.com/dav/username/Calendar/Hockey_Calendar/");
  
  CalDAV.StartDate = "20100401T040000";
  CalDAV.EndDate = "20100401T060000";
  CalDAV.UID = "qwerty1234567";
  CalDAV.Summary = "First Practice";
  CalDAV.Location = "Rink on 1st and main";
  CalDAV.EventType = vEvent;
  CalDAV.PutCalendarEvent("https://caldav.calendar.yahoo.com/dav/username/Calendar/Hockey_Calendar/qwerty1234567.ics");
  
  CalDAV.GetCalendarReport("https://caldav.calendar.yahoo.com/dav/username/Calendar/Hockey_Calendar/");

Property List


The following is the full list of the properties of the class with short descriptions. Click on the links for further details.

alarm_countThe number of records in the Alarm arrays.
alarm_actionThis property determines what the CalDAV server will do when the alarm Trigger is reached.
alarm_attachmentThis property contains a sound file attached to the alarm.
alarm_attachment_typeThis property contains the MIME-Type of the attachment.
alarm_durationThis property contains the interval between repeating alarms.
alarm_messageThis property contains a message used to alert the user when this alarm is triggered.
alarm_recipientThis property contains the email address of the person to be alerted when this alarm is triggered.
alarm_repeatThis property contains the number of times the alarm is to be repeated after the initial trigger.
alarm_subjectThis property contains the subject of the message used to alert the user when this alarm is triggered.
alarm_triggerThis property contains the time when the alarm is triggered.
attendeesDefines one or more participants that have been invited to the event.
authorizationThe Authorization string to be sent to the server.
auth_schemeThe authentication scheme to use when server authorization is required.
categoriesUsed to specify categories or subtypes of the calendar event.
classificationDefines the access classification for a calendar class.
completedDate and time that a to-do was actually completed.
connectedShows whether the class is connected.
cookie_countThe number of records in the Cookie arrays.
cookie_domainThe domain of a received cookie.
cookie_expirationThis property contains an expiration time for the cookie (if provided by the server).
cookie_nameThe name of the cookie.
cookie_pathThis property contains a path name to limit the cookie to (if provided by the server).
cookie_secureThis property contains the security flag of the received cookie.
cookie_valueThis property contains the value of the cookie.
createdDate and time calendar information created.
custom_property_countThe number of records in the CustomProperty arrays.
custom_property_attributeThis property contains an optional attribute of the custom property.
custom_property_nameThis property contains the textual name of the custom property.
custom_property_valueThis property contains the value of the custom property.
depthThe depth associated with the current operation.
descriptionProvides a complete description of the calendar event.
display_nameProvides the display name of the calendar being created.
due_dateSpecifies the due date for a calendar event.
durationDuration of the calendar event.
end_dateSpecifies the date and time that a calendar event ends.
e_tagIdentifier returned by the CalDAV server which is used to synchronize edits.
event_typeIndicates the type of calendar object resource.
firewall_auto_detectThis property tells the class whether or not to automatically detect and use firewall system settings, if available.
firewall_typeThis property determines the type of firewall to connect through.
firewall_hostThis property contains the name or IP address of firewall (optional).
firewall_passwordThis property contains a password if authentication is to be used when connecting through the firewall.
firewall_portThis property contains the TCP port for the firewall Host .
firewall_userThis property contains a user name if authentication is to be used connecting through a firewall.
follow_redirectsDetermines what happens when the server issues a redirect.
free_busy_countThe number of records in the FreeBusy arrays.
free_busy_rangeContains the date/time range when the calendar owner is busy.
free_busy_typeIndicates the busy status of the corresponding BusyRange .
idleThe current status of the class.
last_modifiedThe date and time that the information associated with the calendar event was last revised in the calendar store.
local_hostThe name of the local host or user-assigned IP interface through which connections are initiated or accepted.
locationDefines the intended venue for the activity defined by a calendar class.
lock_typeThe type of the current resource lock.
lock_ownerThe principle that owns the current resource lock.
lock_scopeThe scope of the current resource lock.
lock_timeoutThe time to live for the current resource lock.
lock_tokensThe lock string to be used when submitting operations on a locked resource.
organizerDefines the organizer of a calendar event.
other_headersOther headers as determined by the user (optional).
parsed_header_countThe number of records in the ParsedHeader arrays.
parsed_header_fieldThis property contains the name of the HTTP header (same case as it is delivered).
parsed_header_valueThis property contains the header contents.
passwordA password if authentication is to be used.
priorityDefines the relative priority for a calendar event.
proxy_auth_schemeThis property is used to tell the class which type of authorization to perform when connecting to the proxy.
proxy_auto_detectThis property tells the class whether or not to automatically detect and use proxy system settings, if available.
proxy_passwordThis property contains a password if authentication is to be used for the proxy.
proxy_portThis property contains the TCP port for the proxy Server (default 80).
proxy_serverIf a proxy Server is given, then the HTTP request is sent to the proxy instead of the server otherwise specified.
proxy_sslThis property determines when to use SSL for the connection to the proxy.
proxy_userThis property contains a user name, if authentication is to be used for the proxy.
recurrence_datesIndividual dates on which the event will recur.
recurrence_exception_datesDefines the list of DATE-TIME exceptions to the recurrence set.
recurrence_exception_ruleDefines a rule or repeating pattern for an exception to the recurrence set.
recurrence_idIdentifies a recurring event.
recurrence_ruleThis property defines the recurrence rule for the event.
report_filter_alarm_endLimits the events returned in the report to only those with an alarm set in the range specified by AlarmStart and AlarmEnd .
report_filter_alarm_startLimits the events returned in the report to only those with an alarm set in the range specified by AlarmStart and AlarmEnd .
report_filter_custom_filterAllows the user to specify his own filter XML.
report_filter_end_dateLimits the events returned in the report to only those which occur in the time range specified by StartDate and EndDate .
report_filter_event_typeIndicates the type of calendar object resources to return in a Report.
report_filter_propertyLimits the events returned in a Report to only those which contain a matching property name and value.
report_filter_recur_endLimits the recurring events returned in the report.
report_filter_recur_startLimits the recurring events returned in the report.
report_filter_return_calendar_dataControls whether the contents of each calendar event is returned in the report.
report_filter_start_dateLimits the events returned in the report to only those which occur in the time range specified by StartDate and EndDate .
report_filter_uidLimits the recurring events returned in the report to only those with the specified UID.
sequenceDefines the revision sequence number of the event within a sequence of revisions.
ssl_accept_server_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_encodedThe certificate (PEM/base64 encoded).
ssl_cert_storeThe name of the certificate store for the client certificate.
ssl_cert_store_passwordIf the certificate store is of a type that requires a password, this property is used to specify that password in order to open the certificate store.
ssl_cert_store_typeThe type of certificate store for this certificate.
ssl_cert_subjectThe subject of the certificate used for client authentication.
ssl_server_cert_encodedThe certificate (PEM/base64 encoded).
start_dateSpecifies the date and time that an event begins.
statusDefines the overall status or confirmation for the calendar event.
status_lineThe first line of the last server response.
summaryDefines a short summary or subject for the calendar event.
timeoutA timeout for the class.
timestampSpecifies the date and time that the instance of the event was created.
timezone_dst_nameThe customary name for the daylight-savings time zone.
timezone_dst_offset_fromThe UTC offset that is in use when the onset of this time zone observance begins.
timezone_dst_offset_toThe UTC offset for daylight savings time, when this observance is in use.
timezone_dst_ruleThis property defines the recurrence rule for the onset of this daylight savings time observance.
timezone_dst_startThe effective onset date and local time for the daylight-time time zone definition.
timezone_last_modifiedThis optional property is a UTC value that specifies the date and time that this time zone definition was last updated.
timezone_std_nameThe customary name for the standard time zone.
timezone_std_offset_fromThe UTC offset that is in use when the onset of this time zone observance begins.
timezone_std_offset_toThe UTC offset for standard time, when this observance is in use.
timezone_std_ruleThis property defines the recurrence rule for the onset of this standard time observance.
timezone_std_startThe effective onset date and local time for the standard-time time zone definition.
timezone_idThis property specifies a text value that uniquely identifies this CalTimezone calendar class.
timezone_urlOptionally points to a published time zone definition.
transparencyDefines whether or not an event is transparent to busy time searches.
uidA persistent, globally unique identifier for the calendar event.
urlLocation of the event resource on the CalDAV server.
userA user name if authentication is to be used.

Method List


The following is the full list of the methods of the class with short descriptions. Click on the links for further details.

add_cookieAdds a cookie and the corresponding value to the outgoing request headers.
add_custom_propertyAdds a form variable and the corresponding value.
configSets or retrieves a configuration setting.
copy_calendar_eventCopy events to a new location.
create_calendarCreates a new calendar collection resource.
delete_calendar_eventDelete a resource or collection.
do_eventsProcesses events from the internal message queue.
export_icsGenerates an event from the properties in the iCal (.ICS) format.
get_calendar_eventRetrieves a single event from the CalDAV server.
get_calendar_optionsRetrieves options for the ResourceURI to determines whether it supports calendar access.
get_calendar_reportGenerates a report on the indicated calendar collection resource.
get_free_busy_reportGenerates a report as to when the calendar owner is free and/or busy.
import_icsImports iCal data (contained in an ICS file) into the class's property list.
interruptInterrupt the current method.
lock_calendarObtain a lock for a specified calendar resource.
move_calendar_eventMoves one calendar resource to a new location.
put_calendar_eventAdds a calendar resource at the specified ResourceURI using the CalDAV PUT method.
resetReset the class.
un_lock_calendarUnlocks a calendar resource.

Event List


The following is the full list of the events fired by the class with short descriptions. Click on the links for further details.

on_connectedFired immediately after a connection completes (or fails).
on_connection_statusFired to indicate changes in connection state.
on_disconnectedFired when a connection is closed.
on_end_transferFired when a document finishes transferring.
on_errorInformation about errors during data delivery.
on_event_detailsFires for each calendar event received.
on_free_busyFires for each Free/Busy element received in the response.
on_headerFired every time a header line comes in.
on_logFires once for each log message.
on_redirectFired when a redirection is received from the server.
on_set_cookieFired for every cookie set by the server.
on_ssl_server_authenticationFired after the server presents its certificate to the client.
on_ssl_statusShows the progress of the secure connection.
on_start_transferFired when a document starts transferring (after the headers).
on_statusFired when the HTTP status line is received from the server.
on_transferFired while a document transfers (delivers document).

Configuration Settings


The following is a list of configuration settings for the class with short descriptions. Click on the links for further details.

AuthSchemeThe authentication scheme to use for server authorization.
BuildEventBuilds the current event for a multi-event calendar entry.
EndCalendarSignifies the end of a multi-event calendar entry.
ExpandRecurringEventsInstructs the class to return all instances of a recurring event within a timeframe.
ProductIdSpecifies the identifier for the product that created the iCalendar object.
RecurrenceExceptionDatesAttrsSpecifies the attributes for the exception dates of a recurring event.
StartCalendarSignifies the beginning of a multi-event calendar entry.
IsDir[i]Whether or not the resource at the specified index is a directory.
AcceptEncodingUsed to tell the server which types of content encodings the client supports.
AllowHTTPCompressionThis property enables HTTP compression for receiving data.
AllowHTTPFallbackWhether HTTP/2 connections are permitted to fallback to HTTP/1.1.
AppendWhether to append data to LocalFile.
AuthorizationThe Authorization string to be sent to the server.
BytesTransferredContains the number of bytes transferred in the response data.
ChunkSizeSpecifies the chunk size in bytes when using chunked encoding.
CompressHTTPRequestSet to true to compress the body of a PUT or POST request.
EncodeURLIf set to true the URL will be encoded by the class.
FollowRedirectsDetermines what happens when the server issues a redirect.
GetOn302RedirectIf set to true the class will perform a GET on the new location.
HTTP2HeadersWithoutIndexingHTTP2 headers that should not update the dynamic header table with incremental indexing.
HTTPVersionThe version of HTTP used by the class.
IfModifiedSinceA date determining the maximum age of the desired document.
KeepAliveDetermines whether the HTTP connection is closed after completion of the request.
KerberosSPNThe Service Principal Name for the Kerberos Domain Controller.
LogLevelThe level of detail that is logged.
MaxRedirectAttemptsLimits the number of redirects that are followed in a request.
NegotiatedHTTPVersionThe negotiated HTTP version.
OtherHeadersOther headers as determined by the user (optional).
ProxyAuthorizationThe authorization string to be sent to the proxy server.
ProxyAuthSchemeThe authorization scheme to be used for the proxy.
ProxyPasswordA password if authentication is to be used for the proxy.
ProxyPortPort for the proxy server (default 80).
ProxyServerName or IP address of a proxy server (optional).
ProxyUserA user name if authentication is to be used for the proxy.
SentHeadersThe full set of headers as sent by the client.
StatusLineThe first line of the last response from the server.
TransferredDataThe contents of the last response from the server.
TransferredDataLimitThe maximum number of incoming bytes to be stored by the class.
TransferredHeadersThe full set of headers as received from the server.
TransferredRequestThe full request as sent by the client.
UseChunkedEncodingEnables or Disables HTTP chunked encoding for transfers.
UseIDNsWhether to encode hostnames to internationalized domain names.
UsePlatformHTTPClientWhether or not to use the platform HTTP client.
UserAgentInformation about the user agent (browser).
ConnectionTimeoutSets a separate timeout value for establishing a connection.
FirewallAutoDetectTells the class whether or not to automatically detect and use firewall system settings, if available.
FirewallHostName or IP address of firewall (optional).
FirewallPasswordPassword to be used if authentication is to be used when connecting through the firewall.
FirewallPortThe TCP port for the FirewallHost;.
FirewallTypeDetermines the type of firewall to connect through.
FirewallUserA user name if authentication is to be used connecting through a firewall.
KeepAliveIntervalThe retry interval, in milliseconds, to be used when a TCP keep-alive packet is sent and no response is received.
KeepAliveTimeThe inactivity time in milliseconds before a TCP keep-alive packet is sent.
LingerWhen set to True, connections are terminated gracefully.
LingerTimeTime in seconds to have the connection linger.
LocalHostThe name of the local host through which connections are initiated or accepted.
LocalPortThe port in the local host where the class binds.
MaxLineLengthThe maximum amount of data to accumulate when no EOL is found.
MaxTransferRateThe transfer rate limit in bytes per second.
ProxyExceptionsListA semicolon separated list of hosts and IPs to bypass when using a proxy.
TCPKeepAliveDetermines whether or not the keep alive socket option is enabled.
TcpNoDelayWhether or not to delay when sending packets.
UseIPv6Whether to use IPv6.
LogSSLPacketsControls whether SSL packets are logged when using the internal security API.
OpenSSLCADirThe path to a directory containing CA certificates.
OpenSSLCAFileName of the file containing the list of CA's trusted by your application.
OpenSSLCipherListA string that controls the ciphers to be used by SSL.
OpenSSLPrngSeedDataThe data to seed the pseudo random number generator (PRNG).
ReuseSSLSessionDetermines if the SSL session is reused.
SSLCACertFilePathsThe paths to CA certificate files on Unix/Linux.
SSLCACertsA newline separated list of CA certificate to use during SSL client authentication.
SSLCheckCRLWhether to check the Certificate Revocation List for the server certificate.
SSLCipherStrengthThe minimum cipher strength used for bulk encryption.
SSLEnabledCipherSuitesThe cipher suite to be used in an SSL negotiation.
SSLEnabledProtocolsUsed to enable/disable the supported security protocols.
SSLEnableRenegotiationWhether the renegotiation_info SSL extension is supported.
SSLIncludeCertChainWhether the entire certificate chain is included in the SSLServerAuthentication event.
SSLNegotiatedCipherReturns the negotiated ciphersuite.
SSLNegotiatedCipherStrengthReturns the negotiated ciphersuite strength.
SSLNegotiatedCipherSuiteReturns the negotiated ciphersuite.
SSLNegotiatedKeyExchangeReturns the negotiated key exchange algorithm.
SSLNegotiatedKeyExchangeStrengthReturns the negotiated key exchange algorithm strength.
SSLNegotiatedVersionReturns the negotiated protocol version.
SSLProviderThe name of the security provider to use.
SSLSecurityFlagsFlags that control certificate verification.
SSLServerCACertsA newline separated list of CA certificate to use during SSL server certificate validation.
TLS12SignatureAlgorithmsDefines the allowed TLS 1.2 signature algorithms when UseInternalSecurityAPI is True.
TLS12SupportedGroupsThe supported groups for ECC.
TLS13KeyShareGroupsThe groups for which to pregenerate key shares.
TLS13SignatureAlgorithmsThe allowed certificate signature algorithms.
TLS13SupportedGroupsThe supported groups for (EC)DHE key exchange.
AbsoluteTimeoutDetermines whether timeouts are inactivity timeouts or absolute timeouts.
FirewallDataUsed to send extra data to the firewall.
InBufferSizeThe size in bytes of the incoming queue of the socket.
OutBufferSizeThe size in bytes of the outgoing queue of the socket.
BuildInfoInformation about the product's build.
CodePageThe system code page used for Unicode to Multibyte translations.
LicenseInfoInformation about the current license.
ProcessIdleEventsWhether the class uses its internal event loop to process events when the main thread is idle.
SelectWaitMillisThe length of time in milliseconds the class will wait when DoEvents is called if there are no events to process.
UseInternalSecurityAPITells the class whether or not to use the system security libraries or an internal implementation.

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks 2020 Python Edition - Version 20.0 [Build 8307]