Welcome to pyICSParser’s documentation!

Contents:

Icalendar (RFC5545, RFC2445) parser/validator/generator/events enumerator : Parse, Generate and enumerate events (support of RRULE, EXRULE, RDATE, EXDATE)

About

This module is an icalendar parser for icalendar file (ical or ics) defined by rfc5545 (http://tools.ietf.org/html/rfc5545), which obsoleted rfc2445 (http://www.ietf.org/rfc/rfc2445.txt), which had previously replaced vcal 1.0 (http://www.imc.org/pdi/vcal-10.txt).

The icalendar file, once parsed, will be available as a typed structure. Events dates can be computed (including rrule, rdate exrule and exdates).

icalendar module and dateutils both provide some of the functionalities of this module but do not provide it in an integrated way.

Usage

  • Enumerator of icalendar file:

    mycal = ical.ics() mycal.local_load(icsfile) mycal.parse_loaded() dates = mycal.get_event_instances(start,end) #dates will contain the json with all explicit dates of the events spec’ed by the icalendar file

To come

  • 0.6.1y: add support for no dtstart and/or not dtend + add support for RDATE after UNTIL

  • 0.6.1z: add unittest support

  • 0.6.2a: add code for event_instances (including support for overlapping), event.instances.isbounded, event.instances.walk,

    add code for multiple rrule, exrule, add code for event_instances[‘day’]

  • 0.6.2b: add code for property parameters, property values, delimiters (linear, wlsp), ENCODING, character sets, language, binary values,XAPIA’s CSA RRULE,

    x-components and x-properties parsing + for x-properties adding the type of data

  • 0.6.2c: add code for x-components and x-properties generation

  • 0.6.2d: add loader and generator for todo, alarm

  • 0.7.x: add datetime and tzinfo

  • 0.8.x: add support for non-standard compliance: no tzoneinfo, escaped characters, ...

  • Extend support to new x-properties for icalendar like events related to religious dates or celestial events

History

Created on Aug 4, 2011

@author: oberron @change: to 0.4 - passes all unit test in ical_test v0.1 @change: 0.4 to 0.5 adds EXDATE support @change: 0.5 to 0.6 adds support for no DTEND and DTEND computation from DURATION or DTSTART @version: 0.6.x

class ical.ics

Icalendar (RFC5545, RFC2445) parser/validator/generator/events enumerator

Parse, Generate and enumerate events (support of RRULE, EXRULE, RDATE, EXDATE) usage:

Enumerator:

mycal = ical.ics()

mycal.local_load(icsfile)

mycal.parse_loaded()

dates = mycal.get_event_instances(sDate,eDate)

#start end end are strings in yyyymmdd format

#dates will contain the json with all explicit dates of the events spec’ed by the icalendar file

GenRRULEstr(rules)

Generates RRULE string from rules dictionary

Used by generator.

OccurencesWindowEndDate

Date until which occurences of icalendar events should be returned by the enumerator

OccurencesWindowStartDate

Date from which occurences of icalendar events should be returned by the enumerator

debug(TrueFalse, LogPath='', debug_level=0)

enables logging when executing (warning severe slow down)

events

object holding the parsed icalendar

get_event_instances(start='20130111', end='20130111', count=-1)

Returns an array of events with dates, uid, and summary

The function returns the array of events within a given date window (defined by start and end), should only a certain number of events be needed either from a start date or to an end date the missing date should be set to Null

inf()

Returns generic info

local_load(sLocalFilePath, conformance=False, append=False)

loads icalendar file from local path

conformance will force / or not checking ics file for conformance (not supported yet)

parse_loaded()

parse loaded ical from file to array of typed data: self.events

strings_load(strings, conformance=False, append=False)

Loads icalendar from array of strings

conformance will force / or not checking ics file for conformance (not supported yet)

validate()

@TODO: add here code to consolidate existing parser warnings

class ical.vevent

Parses a vevent (object from vcalendar as defined by the icalendar standard (RFC5545)

class ical.ics

Icalendar (RFC5545, RFC2445) parser/validator/generator/events enumerator

Parse, Generate and enumerate events (support of RRULE, EXRULE, RDATE, EXDATE) usage:

Enumerator:

mycal = ical.ics()

mycal.local_load(icsfile)

mycal.parse_loaded()

dates = mycal.get_event_instances(sDate,eDate)

#start end end are strings in yyyymmdd format

#dates will contain the json with all explicit dates of the events spec’ed by the icalendar file

GenRRULEstr(rules)

Generates RRULE string from rules dictionary

Used by generator.

OccurencesWindowEndDate

Date until which occurences of icalendar events should be returned by the enumerator

OccurencesWindowStartDate

Date from which occurences of icalendar events should be returned by the enumerator

debug(TrueFalse, LogPath='', debug_level=0)

enables logging when executing (warning severe slow down)

events

object holding the parsed icalendar

get_event_instances(start='20130111', end='20130111', count=-1)

Returns an array of events with dates, uid, and summary

The function returns the array of events within a given date window (defined by start and end), should only a certain number of events be needed either from a start date or to an end date the missing date should be set to Null

inf()

Returns generic info

local_load(sLocalFilePath, conformance=False, append=False)

loads icalendar file from local path

conformance will force / or not checking ics file for conformance (not supported yet)

parse_loaded()

parse loaded ical from file to array of typed data: self.events

strings_load(strings, conformance=False, append=False)

Loads icalendar from array of strings

conformance will force / or not checking ics file for conformance (not supported yet)

validate()

@TODO: add here code to consolidate existing parser warnings

Indices and tables

Table Of Contents

This Page