def GetEvents(self, since, until, force_reload): wc = WebCal(url, username, passwd) uids = wc.get_calendar_uids() isoformat = "%Y-%m-%dT%H:%M:%S.%f" events = [] for uid in uids: cal = ICal(wc.get_calendar(uid)) feed = cal.get_events() for event in feed: start_date = event.get_start_datetime() end_date = event.get_end_datetime() if ((end_date - start_date) == timedelta(1)): allday = True else: allday = False start = int(mktime(start_date.timetuple())) end = int(mktime(end_date.timetuple())) events.append(( '', str(event.get_summary()), '', allday, start, end, {})) return events
#================== CONFIG ================ url = 'CALENDAR URL' username = '******' passwd = 'YOUR PASSWORD' #================ END CONFIG ============== from pywebcal import WebCal, ICal from datetime import datetime, timedelta from dateutil.tz import tzical, gettz wc = WebCal(url, username, passwd) uids = wc.get_calendar_uids() n = datetime.now(gettz()) u = n + timedelta(days=7) events = [] for uid in uids: cal = ICal(wc.get_calendar(uid)) es = cal.events_between(n, u) for dt, e in es: events.append((e.get_summary(), e.get_start_datetime())) print "Events in next week: %s\n" % events
#================== CONFIG ================ url = 'CALENDAR URL' username = '******' passwd = 'YOUR PASSWORD' #================ END CONFIG ============== from pywebcal import WebCal, ICal from datetime import datetime, timedelta from dateutil.tz import tzical, gettz wc = WebCal(url, username, passwd) uids = wc.get_calendar_uids() n = datetime.now(gettz()) u = n + timedelta(days=7) events = [] for uid in uids: cal = wc.get_calendar(uid) es = cal.events_between(n, u) for dt, e in es: events.append(e) for e in sorted(events, key=lambda event: event.get_start_datetime()): print "%s: %s" % (e.get_start_datetime(), e.get_summary().encode('utf-8'))
#================== CONFIG ================ url = 'CALENDAR URL' username = '******' passwd = 'YOUR PASSWORD' #================ END CONFIG ============== from pywebcal import WebCal, ICal from datetime import datetime, timedelta from dateutil.tz import tzical, gettz wc = WebCal(url, username, passwd) uids = wc.get_calendar_uids() n = datetime.now(gettz()) u = n + timedelta(days=7) events = [] for uid in uids: cal = wc.get_calendar(uid) es = cal.events_between(n, u) for dt, e in es: events.append(e) for e in sorted(events, key=lambda event:event.get_start_datetime()): print "%s: %s" % (e.get_start_datetime(), e.get_summary().encode('utf-8'))