iCalendar reader for Python?

Question:

I’m looking to automate the status reports that I have to send to my manager. Since I use a to-do software that writes to iCalendar format, I would like be able to format an email out of the ics file.

I’m starting my work with: http://codespeak.net/icalendar/ which looks pretty good, but it does have some rough edges.

What iCalendar reader would you suggest for python?

Asked By: Alterlife

||

Answers:

I know this question is old, but this looks to be the most popular Python iCalendar parser these days. It’s available on Pypi.

Pypi page: https://pypi.python.org/pypi/icalendar
Documentation: http://icalendar.readthedocs.org/en/latest/
Github: https://github.com/collective/icalendar

Answered By: Jacinda

There is ics.py which has a very "pythonic" interfaces and abstracts away the not very intuitive syntax of the iCalendar format RFC5545.

Example:

>>> from ics import Calendar, Event
>>> from datetime import datetime
>>> c = Calendar()
>>> e = Event()
>>> e.name = "My cool event"
>>> e.begin = '20140101 10:00:00'
>>> e.end = datetime(2014, 1, 1, 11, 30)
>>> c.events.append(e)
>>> c.events
[<Event 'My cool event' begin:2014-01-01 10:00:00 end:2014-01-01 11:30:00>]
>>> with open('my.ics', 'w') as my_file:
>>>     my_file.writelines(c)
Answered By: jammon

I had this question as well some time ago but got frustrated with all of them. They either didn’t parse my calendar at all or they didn’t support recurring events. I also didn’t want to use a package that was build upon another iCalendar package.

Hence, I created my own: https://pypi.org/project/ical-library/.
Give it a try, hopefully it will be your one-stop for iCalendars.

I am always on the look out for feedback / issues so please feel free to raise any issue on the Github repo :)!

Answered By: Jorrick Sleijster
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.