commit 9ad583ec75255959692c31d3720db3409e2b1db0
parent 897dfde51296c1b4f333326d79a168d3d9f9770b
Author: Andreas Gruhler <agruhl@gmx.ch>
Date: Sat, 20 Sep 2025 22:06:50 +0200
feat(caldav): use recommended get_davclient with v2.0.1
Diffstat:
3 files changed, 18 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
@@ -70,3 +70,11 @@ Example skiing/available all day:
"pm": true,
"am": true,
```
+
+## Caldav remotes
+
+Tested following remotes.
+
+GMX:
+* https://hilfe.gmx.net/kalender/mobil/apps.html
+* https://caldav.gmx.net/begenda/dav/users ("https://caldav.gmx.net" unuathorized)
+\ No newline at end of file
diff --git a/requirements.txt b/requirements.txt
@@ -2,4 +2,4 @@ pytest
coverage
requests
requests_mock
-caldav
+caldav==2.0.1
diff --git a/waldhart_availability.py b/waldhart_availability.py
@@ -4,7 +4,7 @@ import logging
import secrets
import os
import requests
-import caldav
+from caldav.davclient import get_davclient
from datetime import datetime
from enum import Enum
@@ -88,11 +88,11 @@ class WaldhartAvailability:
raise NameError("SEASON undefined")
# DAVClient
- # * https://caldav.readthedocs.io/en/latest/caldav/davclient.html
+ # * https://caldav.readthedocs.io/stable/tutorial.html
# * https://github.com/python-caldav/caldav/blob/master/examples/basic_usage_examples.py
- self.dav_client = caldav.DAVClient(url=self.caldav_url,
- username=self.caldav_username,
- password=self.caldav_password)
+ self.dav_client = get_davclient(url=self.caldav_url,
+ username=self.caldav_username,
+ password=self.caldav_password)
self.logger.info(f"Connected to CalDAV API {self.caldav_url}")
@@ -153,6 +153,8 @@ class WaldhartAvailability:
for e in events:
e.delete()
+ self.logger.info(f"Cleared existing events on {year}-{month}-{day}")
+
# don't create a blocker when not available for skiing or on-call
if duration in [Duration.NV, Duration.CALL]:
self.logger.debug(f"Not available (NV) or on-call, not creating any blocker")
@@ -167,6 +169,7 @@ class WaldhartAvailability:
summary="Skiing",
)
+ self.logger.info(f"Created event")
self.logger.debug(f"Created event: {e}")
def duration_type(self, entry: str) -> Duration: