Fetch publicly available google calendar data with python
I tried accessing the google data api with python - that api seems either overly complicated or just not suited for just grabbing events from a public google calendar.
This worked for me:
- find out ical address (subscribe to the calendar, other calendars->arrow down->calendar settings)
- install icalendar
Then this is possible:
PYTHON:
-
from icalendar import Calendar
-
import urllib
-
ics = urllib.urlopen('http://www.google.com/calendar/ical/fchppllvcaupb6fgguigobkfj4@group.calendar.google.com/public/basic.ics').read()
-
ical=Calendar.from_string(ics)
-
for vevent in ical.subcomponents:
-
if vevent.name != "VEVENT":
-
continue
-
title = str(vevent.get('SUMMARY'))
-
description = str(vevent.get('DESCRIPTION'))
-
location = str(vevent.get('LOCATION'))
-
start = vevent.get('DTSTART').dt # a datetime
-
end = vevent.get('DTEND').dt # a datetime