Advertisement
Guest User

Untitled

a guest
May 5th, 2017
567
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.65 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3.  
  4. try:
  5.   from xml.etree import ElementTree # for Python 2.5 users
  6. except ImportError:
  7.   from elementtree import ElementTree
  8.  
  9. import gdata.calendar.service
  10. import gdata.service
  11. import atom.service
  12. import gdata.calendar
  13. import atom
  14. import getopt
  15. import sys
  16. import string
  17. import time
  18.  
  19.  
  20. user = 'user@gmail.com'
  21. password = 'password'
  22.  
  23. calendar_service = gdata.calendar.service.CalendarService()
  24. calendar_service.email = user
  25. calendar_service.password = password
  26. calendar_service.source = 'Google-Calendar_Python_Sample-1.0'
  27. calendar_service.ProgrammaticLogin()
  28. feed = calendar_service.GetAllCalendarsFeed()
  29.  
  30.  
  31. #Retrieving events without query parameters
  32.  
  33. def PrintAllEventsOnDefaultCalendar(calendar_service):
  34.     feed = calendar_service.GetCalendarEventFeed()
  35.     print 'Events on Primary Calendar: %s' % (feed.title.text,)
  36.     for i, an_event in enumerate(feed.entry):
  37.         print '\t%s. %s' % (i, an_event.title.text,)
  38.        
  39.         for p, a_participant in enumerate(an_event.who):
  40.             aa = a_participant.email
  41.             aa = aa.encode('utf-8', "replace")
  42.  
  43.            
  44.             print '\t\t%s. %s' % (p, aa,)
  45.            
  46.             #for zz in a_participant:
  47.             #print a_participant
  48.             #print '- - ' * 10
  49.            
  50.             if a_participant.name:
  51.                 print '\t\t\t%s' % a_participant.name
  52.            
  53.             #if a_participant.attendee_status.value:
  54.             try:
  55.                 print '\t\t\t%s' % a_participant.attendee_status.value
  56.             except:
  57.                 pass
  58.  
  59.  
  60. PrintAllEventsOnDefaultCalendar(calendar_service)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement