我正在尝试使用python编写对共享日历邀请的自动接受脚本。
根据此处的RFC: https://github.com/apple/ccs-calendarserver/blob/master/doc/Extensions/caldav-sharing.txt
我创建了以下xml,作为POST请求发送到我的日历服务器:
accept_invite_xml = """
<?xml version='1.0' encoding='UTF-8'?>
<CS:invite-reply xmlns='DAV:' xmlns:CS='http://calendarserver.org/ns/'>
<href>urn:x-uid:9DCA674E-5AD8-1992-7828-033C09954A5F</href>
<CS:invite-accepted/>
<CS:hosturl>/calendars/__uids__/419A2758-B533-3019-BF05-32CEFB6E79DC/calendar</CS:hosturl>
<CS:in-reply-to>1e9a9754-f896-43cf-a848-d2f71f5eb10b</CS:in-reply-to>
<CS:summary>calendar</CS:summary>
</CS:invite-reply>
"""
这是通过python请求包进行的:
headers = {'Content-Type': 'application/xml', 'charset':"utf-8"}
requests.post(url = my_calendar_home_url,
auth = (username,password),
data=accept_invite_xml,
headers=headers)
但是请继续收到以下答复:
<?xml version='1.0' encoding='UTF-8'?>
<error xmlns='DAV:'>
<valid-request xmlns='http://calendarserver.org/ns/'/>
<error-description xmlns='http://twistedmatrix.com/xml_namespace/dav/'>Missing required XML elements</error-description>
</error>
据我所知,“邀请-回复”中没有任何元素缺失,而“邀请-回复”应该是根元素。我无法访问服务器来检查日志并仅在客户端上进行调试。谢谢。