collective / icalendar

icalendar parser library for Python
https://icalendar.readthedocs.io/en/latest/
Other
976 stars 167 forks source link

multiple periods in 1 freebusy component #27

Open rainerstudhalter opened 12 years ago

rainerstudhalter commented 12 years ago

the following is a freebusy response to a freebusy request

"BEGIN:VCALENDAR VERSION:2.0 PRODID:-//davmail.sf.net/NONSGML DavMail Calendar V1.1//EN METHOD:REPLY BEGIN:VFREEBUSY DTSTAMP:20120131T123000Z ORGANIZER:MAILTO:organizer@domain.tld DTSTART:20120101T000000Z DTEND:20120201T000000Z UID:null ATTENDEE:MAILTO:attendee@domain.tld FREEBUSY;FBTYPE=BUSY:20120103T091500Z/20120103T101500Z,20120113T130000Z/20120113T150000Z,20120116T130000Z/20120116T150000Z,20120117T091500Z/20120117T101500Z,20120118T160000Z/20120118T163000Z,20120124T083000Z/20120124T093000Z,20120124T123000Z/20120124T143000Z,20120131T091500Z/20120131T101500Z END:VFREEBUSY END:VCALENDAR"

when i parse this via icalendar.Calendar.from_ical(myresponse_string) i get the following error:

"Traceback (most recent call last): File "./test.py", line 68, in test2() File "./test.py", line 56, in test2 ical = icalendar.Calendar.from_ical(rtext) File "/usr/local/zope2.13/local/lib/python2.7/site-packages/icalendar-3.0-py2.7.egg/icalendar/cal.py", line 380, in from_ical vals = factory(factory.from_ical(vals)) File "/usr/local/zope2.13/local/lib/python2.7/site-packages/icalendar-3.0-py2.7.egg/icalendar/prop.py", line 774, in from_ical raise ValueError, 'Expected period format, got: %s' % ical ValueError: Expected period format, got: 20120103T091500Z/20120103T101500Z,20120113T130000Z/20120113T150000Z,20120116T130000Z/20120116T150000Z,20120117T091500Z/20120117T101500Z,20120118T160000Z/20120118T163000Z,20120124T083000Z/20120124T093000Z,20120124T123000Z/20120124T143000Z,20120131T091500Z/20120131T101500Z"

according to rfc 5545 this is a valid format, see: http://tools.ietf.org/html/rfc5545#page-62

garbas commented 12 years ago

selfnote: create/update test for this

kfred commented 6 years ago

@rainerwahnsinn would you mind sharing the body of the freebusy request you made? I am trying to figure out freebusy requests and so far have only been able to successfully make free-busy-query requests for my own calendar, but I would like to be able to retrieve the freebusy from other users. Below is the payload I am sending in my request:

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

The following response is what I get:

BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//Example Corp.//CalDAV Client//EN
BEGIN:VFREEBUSY
UID:null
DTSTART:20180711T140000Z
DTEND:20180712T220000Z
DTSTAMP:20180713T191302Z
FREEBUSY;FBTYPE=BUSY:20180711T163000Z/PT30M,20180711T180000Z/PT1H,20180712
 T200000Z/PT30M
END:VFREEBUSY
END:VCALENDAR

How did you get the originator and attendee params to show up in the response?

niccokunzmann commented 10 months ago

@jacadzaca, your contribution is live in v5.0.11. What needs doing about this?