A Case Study on ICalendar Events in Python
You can watch this talk online on Youtube.
A Case Study on ICalendar Events in Python
Are you curious about something? Ask instantly so I can fit answers in!
python-recurring-ical-events
between(start, end)
at(a_date)
and between(start, end)
icalendar
def test_only_one_event_present(calendars):
events = calendars.issue_1.at("20220408")
assert len(events) == 1
BEGIN:VEVENT
... removed lines ...
DTSTART:20220307T120000Z
RRULE:FREQ=WEEKLY;BYDAY=MO
EXDATE:20220314T120000Z
RDATE:20220326T14000Z
END:VEVENT
This talk by Nicco Kunzmann is licensed under the CC-BY-SA 4.0 License.
pip install recurring-ical-events
import icalendar, recurring_ical_events
from urllib.request import urlopen
ical_string = urlopen("http://tinyurl.com/y24m3r8f").read()
calendar = icalendar.Calendar.from_ical(ical_string)
events = recurring_ical_events.of(calendar).at((2019, 3))
for event in events:
print("start {} summary {}".format(event["DTSTART"].dt,
event.get("SUMMARY")))
.ics
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
X-WR-CALNAME:FOSSASIA Talks
BEGIN:VTIMEZONE
TZID:Asia/Singapore
... removed lines ...
END:VTIMEZONE
BEGIN:VEVENT
UID:recurring-ical-events@FOSSASIA2022
SUMMARY:Nicco's Talk about ICAL events!
DTSTART;TZID=Asia/Singapore:20220408T213000
DTEND;TZID=Asia/Singapore:20220408T215500
END:VEVENT
END:VCALENDAR
BEGIN:VEVENT
... removed lines ...
DTSTART:20220307T120000Z
RRULE:FREQ=WEEKLY;BYDAY=MO
EXDATE:20220314T120000Z
RDATE:20220326T14000Z
END:VEVENT