python-caldav / caldav

Apache License 2.0
314 stars 94 forks source link

FreeBusy Bad Request error #325

Open Savvasg35 opened 1 year ago

Savvasg35 commented 1 year ago

Hello 👋

I am trying to run the freebusy_request method on a calendar, but I am getting this error all the time

ReportError at '400 Bad Request
b''', reason no reason

This is how my code look like

with caldav.DAVClient(
        url=caldav_url,
        username=username,
        password=password,
    ) as client:

my_principal = client.principal()

my_calendar = my_principal.calendar(name="My Calendar")

start = datetime.today()
end = datetime.today() + timedelta(days=1)

free_busy = my_calendar.freebusy_request(start=start, end=end)

Any idea what I am doing wrong here?

tobixen commented 1 year ago

Most likely the server does not support freebusy. What server are you using?

Savvasg35 commented 1 year ago

Ah that's helpful, I am using the icloud servers https://caldav.icloud.com

tobixen commented 1 year ago

Not supported in icloud.

I think that there is no official support for the caldav protocol for icloud, even though it's possible to access events using the caldav protocol.

RFC6638 specifies a different way to do freebusy requests, but if I remember correct someone tested that and did not get it to work.

Savvasg35 commented 1 year ago

Ah I see 🤔 I am trying to create an api to sync icloud calendars, and caldav seems to be the only option at the moment. I think for now I can live without the free/busy functionality