简体   繁体   English

如何在python-caldav库中获取忙碌详细信息

[英]How to get freebusy details in python-caldav library

I am using python-caldav and vobject Python libraries to connect to and parse calendar files from a private caldav server. 我正在使用python-caldav和vobject Python库连接到私有caldav服务器并从中解析日历文件。

I cannot for the life of me figure out how to make a freebusy request using these libraries. 我一辈子都无法弄清楚如何使用这些库进行忙碌的请求。 I've searched through the documentation and have searched and searched for examples, but I cannot seem to find any information anywhere. 我在文档中进行了搜索,并在示例中进行了搜索,但是似乎找不到任何信息。

If anyone has any information, I would greatly appreciate it. 如果有人有任何信息,我将不胜感激。 Here is an example from caldav library using details I found in the repo. 这是caldav库中的一个示例,使用了我在回购中找到的详细信息。

url = "https://" + username + ":" + password + "@domain.com/"

client = caldav.DAVClient(url)
principal = client.principal()
calendars = principal.calendars()

calendar = calendars[1]
freebusy = calendar.freebusy_request(datetime(2018,7,12, 12, 0, 0), datetime(2018,7,13, 12, 0, 0))

It returns the following error: 它返回以下错误:

caldav.lib.error.ReportError: 406 Not Acceptable

before you do any programming, check that the ics provider even provides freebusy info. 在进行任何编程之前,请检查ics提供商是否提供了忙碌信息。 You should be able to download the ics file from the url and open it in a text editor to see what it contains. 您应该能够从网址下载ics文件,并在文本编辑器中将其打开以查看其内容。 When you know you have the freebusy in the ics file, then yu can start programmatically dealing with it. 当您知道ics文件中有忙时,yu可以开始以编程方式处理它。

The provider of the ics file from may have special url parameters, but many do not. 的ics文件的提供者可能具有特殊的url参数,但许多没有。 For example with google calendar, calendar settings will determine whether the ics file contains freebusy or normal event data. 例如,对于Google日历,日历设置将确定ics文件是否包含忙碌或正常事件数据。 There is nothing special about the ics url, or the request, it's the google calendar internal settings that determine what the file contains. ics url或请求没有什么特别的,它是由Google日历内部设置确定的文件内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM