caldav is a Python client library for the CalDAV (RFC4791) protocol, enabling interaction with CalDAV servers to manage calendars, events, and tasks. Version 3.1.0 focuses on robustness, improved async support, and enhanced multi-server capabilities. The library maintains an active development cycle, frequently releasing bug fixes and server compatibility improvements, with major releases occurring every few years and minor releases more often.
pip install caldavVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to connect to a CalDAV server, authenticate, retrieve the user's principal, list available calendars, and fetch the first event from each calendar. Credentials can be provided directly or via environment variables for security.
Review the official changelog for specific changes. Test your application thoroughly against the new version, especially if relying on intricate internal behaviors or less common APIs. Consider migrating gradually if in production.
Upgrade to `caldav` v3.1.0 or later for the most stable async experience. Ensure you are correctly `await`ing all asynchronous calls and consulting the latest async examples in the documentation.
For 2.x versions, explicitly install the `niquests` package (`pip install niquests`) if experiencing import errors, or upgrade to a 3.x version where `httpx` is the primary HTTP client.
If you relied on specific behavior of `get_calendars()` in a multi-server context or if your code parses the results assuming a single source, review your implementation to ensure compatibility with the new aggregation capabilities.
Install the package using pip: `pip install caldav`.
Always check if the result of a method call (e.g., `principal.calendars()`, `calendar.events()`) is not empty before attempting to access its elements. For example: `events = calendar.events(); if events: first_event = events[0]`.
Verify the `CALDAV_URL` is correct and accessible. Ensure the CalDAV server is running and not blocked by a firewall. Check if the port (e.g., 8008, 443) is correct and open.
Ensure all methods of `AsyncDAVClient` and its derived objects (like `principal.calendars()`, `calendar.events()`) are properly `await`ed. Your code must be run within an `async def` function and executed using an async event loop (e.g., `asyncio.run()`).