March 2010
Intermediate to advanced
304 pages
8h 23m
English
You can browse or check out the source code from http://code.google.com/p/embed-bot.
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
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) import os from google.appengine.ext.webapp import template import cgi from google.appengine.ext import webapp from google.appengine.ext.webapp.util ...
Read now
Unlock full access