Hi again Mike, I neglected to mention obtaining an AuthSub token to allow your app to write to a user's Google Calendar. This process can be found in the following article:
http://code.google.com/appengine/articles/gdata.html And in the sample app that I'm currently writing, I use the following to generate the AuthSub token request URL which the user needs to visit the first time they try to create a Google Calendar event: # Check to see if the app has permission to write to the user's # Google Calendar. if not isinstance(self.calendar_client.token_store.find_token( 'http://www.google.com/calendar/feeds/default/private/ full'), gdata.auth.AuthSubToken): token_request_url = gdata.auth.generate_auth_sub_url(self.request.uri, ('http://www.google.com/calendar/feeds/default/private/ full',)) When the user authorizes the app and is redirected back to this page, I obtain the AuthSub token and store it for future use: # Find an AuthSub token in the current URL if we arrived at this page from # an AuthSub redirect. auth_token = gdata.auth.extract_auth_sub_token_from_url(self.request.uri) if auth_token: self.calendar_client.SetAuthSubToken( self.calendar_client.upgrade_to_session_token(auth_token)) Thank you, Jeff On Oct 30, 11:04 am, Jeff S <[EMAIL PROTECTED]> wrote: > Hi Mike, > > I have been working on a sample app here and there which allows users > to create an event and optionally add it to their Google Calendar. > Since the primary storage for these events in my example app is in the > App Engine datastore, I've defined a model for an event: > > class Event(db.Model): > title = db.StringProperty(required=True) > description = db.TextProperty() > time = db.DateTimeProperty() > creator = db.UserProperty() > edit_link = db.TextProperty() > gcal_event_link = db.TextProperty() > > class Attendee(db.Model): > email = db.StringProperty() > event = db.ReferenceProperty(Event) > > You probably don't need this, but I point it out because I use these > models to construct the Google Caledar event Atom entry which I send > using the gdata-python-client. Adding the event to Google Calendar in > my sample app looks like this: > > # Create a Google Calendar client to talk to the Google Calendar > service. > self.calendar_client = gdata.calendar.service.CalendarService() > # Modify the client to search for auth tokens in the datastore and > use > # urlfetch instead of httplib to make HTTP requests to Google > Calendar. > gdata.alt.appengine.run_on_appengine(self.calendar_client) > > ... > > # Create a new Google Calendar event. > event_entry = gdata.calendar.CalendarEventEntry() > event_entry.title = atom.Title(text=event.title) > event_entry.content = atom.Content(text=event.description) > start_time = '%s.000Z' % event.time.isoformat() > > event_entry.when.append(gdata.calendar.When(start_time=start_time)) > # Add a who element for each attendee. > if attendee_list: > for attendee in attendee_list: > new_attendee = gdata.calendar.Who() > new_attendee.email = attendee.email > event_entry.who.append(new_attendee) > > # Send the event information to Google Calendar and receive a > # Google Calendar event. > try: > cal_event = self.calendar_client.InsertEvent(event_entry, > 'http://www.google.com/calendar/feeds/default/private/ > full') > edit_link = cal_event.GetEditLink() > if edit_link and edit_link.href: > # Add the edit link to the Calendar event to use for making > changes. > event.edit_link = edit_link.href > alternate_link = cal_event.GetHtmlLink() > if alternate_link and alternate_link.href: > # Add a link to the event in the Google Calendar HTML web > UI. > event.gcal_event_link = alternate_link.href > event.put() > except gdata.service.RequestError, request_exception: > request_error = request_exception[0] > # Handle any insert failures here. > > Note in the above I require the user to be signed in to the app before > getting to the event creation step. Note also, I'm interested in > saving the edit link from the Google Calendar event entry, which is > the URL which needs to be used when sending event changes to Google > Calendar. I also save the alternate link which is the ULR of the event > in the Google Calendar UI. > > Please refer to the Google Calendar developer's guide for a more > detailed list of the what and how of using the Python client library > with Google Calendar: > > http://code.google.com/apis/calendar/developers_guide_python.html > > Happy coding, > > Jeff > > On Oct 29, 1:15 pm, "Mike Metcalfe" <[EMAIL PROTECTED]> wrote: > > > > > Hi Jeff, > > > 2008/10/29 Jeff S <[EMAIL PROTECTED]> > > > > I'm not sure what you mean by the two interfaces. Could you describe > > > these in more detail? > > > The only python development I've done before is using Zope and Plone which > > allow interface classes and the base classes have an 'implements' method. > > This allows you to have one class implement another class's behaviour > > without subclassing it - allowing inheritance from more than one super > > class. I was hoping to have my Resource class implement the Calendar's > > behaviour. I suppose it should just use normal subclassing. > > > As far as using the Google Calendar Data API> from within App Engine, I > > have some sample code if you are interested. > > > I'm interested! > > > Mike --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Google App Engine" group. To post to this group, send email to google-appengine@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/google-appengine?hl=en -~----------~----~----~----~------~----~------~--~---