(GCPi) Google Calendar Python Interface

This package provides some simple classes and methods to communicate with a Google Calendar Account, and, of course, create new events/comments or modifying / delete the existing ones.


Getting started

   from GoogleCalendar import *

   gCalMNG = GoogleCalendarMng()
   gCalMNG.connect (”some_login@gmail.com”, “some_password”)
   calendar = gCalMNG.getCalendar (”myCalendarForTest”)
   events = calendar.getEvents()
   for event in events:
       print event.getTitle()
       print event.getContent()
       print time.strftime(”%Y-%m-%dT%H:%M:%S” ,
                            time.localtime(event.getStartTime()))
       print time.strftime(”%Y-%m-%dT%H:%M:%S” ,
                            time.localtime(event.getEndTime()))


:: Events


Adding new events.

There are two mechanisms:

   ev = newEvent(“Lluis”, “lluis.gesa@gmail.org”,
                 “Meeting”, “With Aleix to talk about work”, “La Garriga”,
                  time.mktime((2007,03,27,19,30,00)),
                  time.mktime((2007,03,27,21,30,00)))
   calendar.addEvent (ev)
   calendar.newEvent (“Meeting”, “With Aleix to talk about work”, “La Garriga”,
                       time.mktime((2007,03,27,19,30,00)),
                       time.mktime((2007,03,27,21,30,00)))

with this second mechanisms, the user and email used are the same of owner of calendar


Updating events.

   events = calendar.getEvents()
   for event in events:
       if event.getTitle() == “Meeting”:
           event.setContent (event.getContent() + “Changes on location”)
           event.setLocation (“Barcelona”)
           event.update()


Deleting events.

   events = calendar.getEvents()
   for event in events:
       if event.getTitle() == “Meeting”:
           event.delete()


:: Comments

Adding comments.

Like events, there are two methods:

   events = calendar.getEvents()
   for event in events:
       if event.getTitle() == “Meeting”:
            event.newComment (“comment test”)
   events = calendar.getEvents()
   for event in events:
       if event.getTitle() == “Meeting”:
            cmt = newComment (“some_user_mail”, “some_email”,  “Coment test2″)
            event.addComment (cmt)


Updating comments.

   events = calendar.getEvents()
   for event in events:
       if event.getTitle() == “Meeting”:
          comments = event.getComments()
          for comment in comments:
              if comment.getContent() == “comment test”:
                  comment.setContent(“Updated”)
                  comment.update()


Deleting comments.

   events = calendar.getEvents()
   for event in events:
       if event.getTitle() == “Meeting”:
          comments = event.getComments()
          for comment in comments:
              if comment.getContent() == “Updated”:
                  comment.delete()

Manual
The online documentation can be found at Manual or if you prefer the python style pydoc

Other references at blog

Download: GoogleCalendar-0.6.tar.gz

Please report me any comment or suggest : lluis.gesa at gmail dot com

WordPress database error: [Table './wplogdb/wp_bdprt_hits' is marked as crashed and last (automatic?) repair failed]
INSERT INTO wp_bdprt_hits (ref_ident, browser_ident, ip_address, target_ident, time_of_hit) VALUES ('1', '1870', '38.103.63.16', '216', '1215346267')