iCalendar package for Python. #ICalendar parser #ICalendar generator #Calendar #Parser #Generator #Python
iCalendar is a generator/parser of iCalendar files for use with Python. It follows the RFC 2445 (iCalendar) specification.
To open and parse a file:
>>> from icalendar import Calendar, Event >>> cal = Calendar.from_string(open('test.ics','rb').read()) >>> cal VCALENDAR({'VERSION': vText(u'2.0'), 'METHOD': vText(u'Request'), 'PRODID': vText(u'-//My product//mxm.dk/')})
>>> for component in cal.walk(): ... component.name 'VCALENDAR' 'VEVENT' 'VEVENT'
To create a calendar and write it to disk:
>>> cal = Calendar() >>> from datetime import datetime >>> from icalendar import UTC # timezone >>> cal.add('prodid', '-//My calendar product//mxm.dk//') >>> cal.add('version', '2.0')
>>> event = Event() >>> event.add('summary', 'Python meeting about calendaring') >>> event.add('dtstart', datetime(2005,4,4,8,0,0,tzinfo=UTC)) >>> event.add('dtend', datetime(2005,4,4,10,0,0,tzinfo=UTC)) >>> event.add('dtstamp', datetime(2005,4,4,0,10,0,tzinfo=UTC)) >>> event['uid'] = '20050115T101010/[email protected]' >>> event.add('priority', 5)
>>> cal.add_component(event)
>>> f = open('example.ics', 'wb') >>> f.write(cal.as_string()) >>> f.close()
System requirements
What's new in iCalendar 3.0.1 Beta 1:
- Update Release information. [thet]
iCalendar 3.0.1 Beta 1
add to watchlist add to download basket send us an update REPORT- runs on:
- Linux
- filename:
- icalendar-3.0.1b1.tar.gz
- main category:
- Utilities
- developer:
- visit homepage