calendaring_sync.adapters.caldav module#

The CalDAV adapter, which syncs one calendar collection through python-caldav.

It needs the caldav extra, as Install shows. Adapters explains every rule it follows, and Server compatibility how each tested server behaves.

calendaring_sync.adapters.caldav.FINGERPRINT_SCHEME = 'caldav-canonical-1'#

The name of the canonical fingerprint this adapter computes. A change to how it’s computed gets a new name, so every scope is listed again.

calendaring_sync.adapters.caldav.MEDIA_TYPE = 'text/calendar'#

The media type of a CalDAV scope’s content, iCalendar data.

calendaring_sync.adapters.caldav.MULTIGET_SIZE = 100#

How many objects one calendar-multiget fetches, and one page of a full listing holds.

class calendaring_sync.adapters.caldav.CalDAVAdapter(replica, calendar, *, scope_id=None)[source]#

Bases: SyncAdapter

Syncs one calendar collection through a synchronous python-caldav client.

The calendar is one scope. The content create() and change() take is iCalendar data in UTF-8, and a create’s must hold an object with a UID; anything else raises ValueError. A write the server won’t take as it was sent becomes a conflict of kind NOT_ALLOWED. Any other failure python-caldav reports, such as a refused login, reaches you as its caldav.lib.error.DAVError, unchanged.

Parameters:
  • replica (Replica) – Where the sync state is kept.

  • calendar (Calendar) – The calendar to sync.

  • scope_id (str | None) – The scope’s id. Defaults to the calendar’s URL, without a login and spelled one way, so calendars on two servers never share a scope and one calendar always gets the same one.

Raises:
  • TypeError – If the calendar is on an asynchronous client, or an argument has the wrong type.

  • ValueError – If the calendar has no URL or no client.

Examples

A sync, an edit, and the sync that pushes it:

adapter = CalDAVAdapter(replica, calendar)
adapter.sync()
key = adapter.create(ics_bytes)
adapter.sync()
property needs_full_listings: bool#

Whether the server may leave changes out without refusing the scope’s token.

Read from the server profile configured on the client, python-caldav’s sync-token.invalid-token feature; Adapter.needs_full_listings says what to do when it’s True.

class calendaring_sync.adapters.caldav.AsyncCalDAVAdapter(replica, calendar, *, scope_id=None)[source]#

Bases: AsyncAdapter

CalDAVAdapter for a calendar on an asynchronous client.

Its methods are coroutines, as AsyncAdapter describes; everything else is as CalDAVAdapter describes.

Raises:
  • TypeError – If the calendar is on a synchronous client, or an argument has the wrong type.

  • ValueError – If the calendar has no URL or no client.

property needs_full_listings: bool#

Whether the server may leave changes out without refusing the scope’s token.

Read from the server profile configured on the client, python-caldav’s sync-token.invalid-token feature; Adapter.needs_full_listings says what to do when it’s True.

Last updated on 2026-11-11.