Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (69 sloc) 3.09 KB
import atom
import getopt
import sys
import string
import time
import gdata.calendar.client
from xml.etree import ElementTree
class Calendar:
def __init__(self, email='paskuuuda', password='jug4beejug4bee'):
source = 'Test Python Client'
self.client = gdata.calendar.client.CalendarClient(source)
self.client.ClientLogin(email, password, self.client.source)
def get_calendars(self, own=False):
if own:
feed = self.client.GetOwnCalendarsFeed()
feed = self.client.GetAllCalendarsFeed()
return feed
def query_event(self, text='', date_start='', date_stop=''):
if text:
query = gdata.calendar.client.CalendarEventQuery(text=text)
elif date_start and date_stop:
query = gdata.calendar.client.CalendarEventQuery(start_min=date_start, start_max=date_start)
feed = self.client.GetCalendarEventFeed(q=query)
return feed
def insert_calendar(self, title='Simple Scheduler.', description='', location='',
time_zone='', hidden=False, color='#2952A3'):
calendar =
calendar.title =
calendar.summary =
calendar.color =
calendar.timezone =
if hidden:
calendar.hidden ='true')
calendar.hidden ='false')
new_calendar = self.client.InsertCalendar(new_calendar=calendar)
return new_calendar
def update_calendar(self):
def delete_calendars(self):
def insert_event(self, title='Simple event.', content='Simple event description.',
where='Wherever.', start_time=None, end_time=None, recurrence_data=None):
event =
event.title =
event.content =
if recurrence_data is not None:
# Set a recurring event
event.recurrence =
elif start_time is None:
# Use current time for the start_time and have the event last 1 hour
start_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z', time.gmtime())
end_time = time.strftime('%Y-%m-%dT%H:%M:%S.000Z',
time.gmtime(time.time() + 3600))
event.when.append(, end=end_time))
new_event = self.client.InsertEvent(event)
return new_event
if __name__ == '__main__':
c = Calendar()
feed = c.get_calendars()
print feed.title.text
print feed.entry[0]
#for f in feed.entry:
# print f