Search code examples
pythoncalendarraspberry-piowncloudcaldav

read owncloud calendar using python via caldav on Raspberry Pi


OVERVIEW
My aim is to develop a Python application running on a Raspberry Pi which reads OwnCloud calendar entries over the network. The calendar itself is part of a local installation of Owncloud which resides on another Raspberry Pi within the same local network. Access is done via HTTPS without active SSL authentification when doing the request.

PROBLEM
I tried to use the caldav Python package. After installation of the package using PIP and Python v2.7, I get an Exception: The CalDAV server you are using has a problem with path handling.

This is what I typed into PYTHON IDLE v2.7:

import caldav  
cal_user='user'  
cal_pass='pass'  
cal_url='https://192.168.1.46/remote.php/caldav/calendars/user/pers%C3%B6nlich'  
cal_client=caldav.DAVClient(cal_url, username='user', password='pass', ssl_verify_cert=False)  
cal_principal=cal_client.principal()

And this is what was printed on the console:

Warning (from warnings module):
File "C:\PROGS\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 789
InsecureRequestWarning)
InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html

Warning (from warnings module):
File "C:\PROGS\Python27\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 789
InsecureRequestWarning)

InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.org/en/latest/security.html

Traceback (most recent call last):
File "<pyshell#9>", line 1, in <module>
cal_principal=cal_client.principal()
File "C:\PROGS\Python27\lib\site-packages\caldav\davclient.py", line 113, in principal
return Principal(self)
File "C:\PROGS\Python27\lib\site-packages\caldav\objects.py", line 307, in __init__
cup = self.get_properties([dav.CurrentUserPrincipal()])
File "C:\PROGS\Python27\lib\site-packages\caldav\objects.py", line 182, in get_properties
raise Exception("The CalDAV server you are using has "

Exception: The CalDAV server you are using has a problem with path handling.

I've tried to play with the URL as much as possible to eliminate any possible typing errors on my side, but I am still not 100% sure I managed to do it right.

Does somebody have a practical explanation for the final exception message in my case? Where could I proceed looking for a solution to my problem?


Solution

  • I was able to reproduce your problem. The solution was to change the calender's name in the URL from

    pers%C3%B6nlich to pers%c3%b6nlich

    Mind the case of the B and the C.