Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- try:
- from xml.etree import ElementTree # for Python 2.5 users
- except ImportError:
- from elementtree import ElementTree
- import gdata.calendar.service
- import gdata.service
- import atom.service
- import gdata.calendar
- import atom
- import getopt
- import sys
- import string
- import time
- user = 'user@gmail.com'
- password = 'password'
- calendar_service = gdata.calendar.service.CalendarService()
- calendar_service.email = user
- calendar_service.password = password
- calendar_service.source = 'Google-Calendar_Python_Sample-1.0'
- calendar_service.ProgrammaticLogin()
- feed = calendar_service.GetAllCalendarsFeed()
- #Retrieving events without query parameters
- def PrintAllEventsOnDefaultCalendar(calendar_service):
- feed = calendar_service.GetCalendarEventFeed()
- print 'Events on Primary Calendar: %s' % (feed.title.text,)
- for i, an_event in enumerate(feed.entry):
- print '\t%s. %s' % (i, an_event.title.text,)
- for p, a_participant in enumerate(an_event.who):
- aa = a_participant.email
- aa = aa.encode('utf-8', "replace")
- print '\t\t%s. %s' % (p, aa,)
- #for zz in a_participant:
- #print a_participant
- #print '- - ' * 10
- if a_participant.name:
- print '\t\t\t%s' % a_participant.name
- #if a_participant.attendee_status.value:
- try:
- print '\t\t\t%s' % a_participant.attendee_status.value
- except:
- pass
- PrintAllEventsOnDefaultCalendar(calendar_service)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement