macOS specific - reading calendar information

Christian Gollwitzer auriocus at gmx.de
Thu Mar 15 03:58:13 EDT 2018


Am 15.03.18 um 08:32 schrieb Jan Erik Moström:
> I would like to read what calendar events I have on a range of days. I 
> would like to get the data from whatever storage Calendar use, in my 
> personal case I sync to iCloud.
> 
> An example would be something along these lines
> 
> x = getcalendarevents('2018-03-15', '2018-03-25')
> 
> or even better
> 
> x = getcalendarevents('2018-03-15', '2018-03-25',[calendar1, calendar2, 
> ...])
> 
> 
> and x would contain some data structure that gives me the events that 
> occurs from 2018-03-15 up to and including 2018-03-25, each event 
> containing at least start/end time, title, place, calendar to which the 
> event belong.

I assume you mean the calendar app included within OSX. It can be 
scripted, start from here: 
https://developer.apple.com/library/content/documentation/AppleApplications/Conceptual/CalendarScriptingGuide/index.html


The native script language is Apple Script or JavaScript. If you want to 
control it from Python, you need a bridge. I have no experience with it, 
but a quick Google search reveals 
https://pypi.python.org/pypi/py-applescript and 
https://docs.python.org/2/library/macosa.html

	Christian



More information about the Python-list mailing list