Embed Bot: Gadgetizing the Google Wave Embed API

You can browse or check out the source code from http://code.google.com/p/embed-bot.

Code: app.yaml File

application: embed-bot
version: 1
runtime: python
api_version: 1

handlers:
- url: /_wave/.*
  script: embed-bot.py
  
- url: /
  script: embed-page.py

- url: /images
  static_dir: images
  
- url: /gadgets
  static_dir: gadgets
  
- url: /js
  static_dir: js
  
- url: /css
  static_dir: css

- url: /about
  static_files: about.html
  upload: about.html

Code: embed-bot.py File

from waveapi import events
from waveapi import robot
from waveapi import element
from waveapi import ops
from waveapi import appengine_robot_runner

import logging
from xml.sax import saxutils

def OnRobotAdded(event, wavelet):
  """Invoked when the robot has been added."""
  wave_id = wavelet.wave_id
  wave_title = wavelet.title
  blip = event.blip
  blip_id = blip.blip_id
  gadget_url = 'http://embed-bot.appspot.com/gadgets/gadget.xml'
  gadget = element.Gadget(gadget_url, {
                          'waveId':wave_id,
                          'waveTitle':wave_title,
                          'blipId':blip_id
                          })
  wavelet.root_blip.reply().append(gadget)

if __name__ == '__main__':
  embedBot = robot.Robot('Embed Bot', 
      image_url='http://embed-bot.appspot.com/images/icon.png',
      profile_url='http://embed-bot.appspot.com/about')
  embedBot.register_handler(events.WaveletSelfAdded, OnRobotAdded)
  appengine_robot_runner.run(embedBot) 

Code: embed-page.py File

import os from google.appengine.ext.webapp import template import cgi from google.appengine.ext import webapp from google.appengine.ext.webapp.util ...

Get Google Wave: Up and Running now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.