Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

freebusy request #31

Closed
kfred opened this issue Jul 12, 2018 · 6 comments
Closed

freebusy request #31

kfred opened this issue Jul 12, 2018 · 6 comments
Labels
Milestone

Comments

@kfred
Copy link

kfred commented Jul 12, 2018

I cannot figure out how to make a freebusy request. Is there anywhere that I can see an example? See below for what I've tried:

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

calendar = calendars[1]
freebusy = calendar.freebusy_request(datetime.today(), datetime.today())

This returns the following error:
'caldav.lib.error.ReportError: 406 Not Acceptable'

@tobixen
Copy link
Member

tobixen commented Mar 9, 2019

Not all servers support freebusy requests. What server do you use?

Sorry for the slow response

@tobixen tobixen added the need-feedback Nothing will be done without more info/feedback from someone that can reproduce the issue label Mar 9, 2019
@tobixen
Copy link
Member

tobixen commented May 5, 2020

closing due to lack of feedback

@tobixen
Copy link
Member

tobixen commented Jan 24, 2021

Found it - it was radicale. According to the related bug report, free-busy requests towards radicale should work. I will have a look into it, probably in the upcoming week.

@tobixen tobixen reopened this Jan 24, 2021
@tobixen tobixen added bug and removed need-feedback Nothing will be done without more info/feedback from someone that can reproduce the issue labels Jan 24, 2021
@tobixen tobixen added this to the v0.8 milestone Jan 24, 2021
@tobixen
Copy link
Member

tobixen commented Jan 24, 2021

I'm doing this towards my old DAViCal server:

>>> caldav.Calendar(client=client, url='house/calendar').freebusy_request(start=datetime.datetime(2011, 10, 9), end=datetime.datetime(2011, 10, 11))

According to the debug logging I'm sending a REPORT towards /caldav.php/house/calendar with the following headers:

User-Agent: Mozilla/5.0
Content-Type: application/xml; charset="utf-8"'
Accept: text/xml, text/calendar
Depth: 1

followed by this XML body:

<?xml version='1.0' encoding='utf-8'?>
<C:free-busy-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"><C:time-range start="20111008T220000Z" end="20111010T220000Z"/></C:free-busy-query>

And I'm receiving a 500 internal server error. Now, that could be ... an internal server error at my old DAViCal server.

The request looks quite similar to the example at https://tools.ietf.org/html/rfc4791#section-7.10.1

I see one difference, there is a DAV namespace enclosed in the <C:free-busy-query ...> opening tag, but I don't think that's a bug (and it's like that in all requests sent to the caldav server).

I'm still investigating.

@tobixen
Copy link
Member

tobixen commented Jan 27, 2021

Radicale ... from the debug logs:

caldav: DEBUG: sending request - method=REPORT, url=http://localhost:5232/user1/pythoncaldav-test/, headers={'User-Agent': 'Mozilla/5.0', 'Content-Type': 'application/xml; charset="utf-8"', 'Accept': 'text/xml, text/calendar', 'Depth': '1'}
body:
<?xml version='1.0' encoding='utf-8'?>
<C:free-busy-query xmlns:D="DAV:" xmlns:C="urn:ietf:params:xml:ns:caldav"><C:time-range start="20070713T150000Z" end="20070715T150000Z"/></C:free-busy-query>
radicale: INFO: REPORT request for '/user1/pythoncaldav-test/' with depth '1' received from ::1 using 'Mozilla/5.0'
radicale: DEBUG: Sanitized script name: ''
radicale: DEBUG: Sanitized path: '/user1/pythoncaldav-test/'
radicale: INFO: Successful login: 'user1'
radicale: DEBUG: Request content:
<?xml version="1.0"?>
<C:free-busy-query xmlns:C="urn:ietf:params:xml:ns:caldav">
  <C:time-range start="20070713T150000Z" end="20070715T150000Z" />
</C:free-busy-query>

radicale: DEBUG: Response content:
<?xml version="1.0"?>
<multistatus xmlns="DAV:">
  <response>
    <href>/user1/pythoncaldav-test/20010712T182145Z-123401%40example.com.ics</href>
  </response>
</multistatus>

So it recognizes the request not as a freebusy-request, but as a report-request towards the calendar.

The RFC states ...

The CALDAV:free-busy-query REPORT request can only be run against a collection (either a regular collection or a calendar collection). An attempt to run the report on a calendar object resource MUST fail and return a 403 (Forbidden) status value.

I'm doing a REPORT towards a calendar collection here, so I believe the library is following the RFC while Radicale is not.

@tobixen
Copy link
Member

tobixen commented Feb 5, 2021

I'm closing this as for now, as I believe the issue is at the radicale side, and due to lack of feedback.

@tobixen tobixen closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants