Hi all, I'm sorry if this is obvious but I'm really stuck. I'm just learning python, and I'm having a hard time navigating the class documentation and finding instance variables, as well as return types. I'm creating a plugin for the Splunk monitoring system the does escalations. We use Google apps for all our calendars, so I want to pull the email to notify via our google apis. I'm having a bit of trouble with this, so you help would be appreciated. I've set up a shared calendar that everyone in my domain has R/W access to. Users enter their schedule by creating all day events and entering their email address as the event name. I want to perform a query on the calendar named "On Call Notifications". Here is what I have so far. Please see the comments for what I want to complete. This is a bit frustrating for a python noob as the examples don't seem to have what I need, and I'm having trouble following the python doc as it's not as clear to me Java or C# on class members and return types.
Thanks, Todd calendarName = 'On Call Notifications' to = '' gmail_user = '[email protected]' gmail_pwd = 'password' calendar_service = gdata.calendar.service.CalendarService() calendar_service.email = gmail_user calendar_service.password = gmail_pwd calendar_service.source = calendarName print 'Logging in to calendar' calendar_service.ProgrammaticLogin() print 'Login complete' #Get the on call calendar calendars = calendar_service.GetAllCalendarsFeed() calendar = filter(lambda cal: cal.title.text.find(calendarName) != -1, calendars.entry) [0] print '\t%s' % (calendar.title.text) print 'finding entries' #Get the entries for the current time (returned from datetime class) then use the event name as an email destination # This query should work, but doesn't seem to # Get the start date and end date from system time currentTime = datetime.datetime.now() start_date=currentTime.strftime("%Y-%m-%d") currentTime = currentTime + datetime.timedelta(days=1) end_date=currentTime.strftime("%Y-%m-%d") print 'Querying calendars by name' #Query always returns nothing even though there is an all day event in the calendar. print 'Date range query for events on Primary Calendar: %s to %s' % (start_date, end_date,) query = gdata.calendar.service.CalendarEventQuery('default', 'private', 'full') query.start_min = start_date query.start_max = end_date feed = calendar_service.CalendarQuery(query) for i, an_event in enumerate(feed.entry): print '\t%s. %s' % (i, an_event.title.text,) for a_when in an_event.when: print '\t\tStart time: %s' % (a_when.start_time,) print '\t\tEnd time: %s' % (a_when.end_time,) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google Calendar Data API" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/google-calendar-help-dataapi?hl=en -~----------~----~----~----~------~----~------~--~---
