Python 3.x 如何使用CalDAV删除事件

Python 3.x 如何使用CalDAV删除事件,python-3.x,string,http,exception,caldav,Python 3.x,String,Http,Exception,Caldav,我想使用CalDAV删除我的下一个日历事件。但是当我试图删除一个对象时,我得到了一个错误 这是我的代码: 导入caldav client=caldav.DAVClient(url=)https://ppp.woelkli.com/remote.php/dav“,用户名=”XXXXXXXX@gmail.com“,密码='Xxxxxxxx') principal=client.principal() calendar=principal.calendars()[0] event=calendar.e

我想使用CalDAV删除我的下一个日历事件。但是当我试图删除一个对象时,我得到了一个错误

这是我的代码:

导入caldav
client=caldav.DAVClient(url=)https://ppp.woelkli.com/remote.php/dav“,用户名=”XXXXXXXX@gmail.com“,密码='Xxxxxxxx')
principal=client.principal()
calendar=principal.calendars()[0]
event=calendar.events()[0]
caldav.Event(client=client,url=str(Event),parent=calendar).delete()

在最后一行中,我得到了以下错误:

我认为正确的代码是

import caldav

client = caldav.DAVClient(url='https://ppp.woelkli.com/remote.php/dav', username='XXXXXXXX@gmail.com', password='Xxxxxxxx')
principal = client.principal()
calendar = principal.calendars()[0]
event = calendar.events()[0]
event.delete()

您可以使用
url=event.url
,它可能会起作用,但Alex Watt的回答更优雅。