def GET(self, name): url = "http://en.wikipedia.org/wiki/" + name preview = wikisnip.wikisnip(url).prettify() web.header('Content-Type', 'text/html; charset=utf-8') yield '<htm>' yield '<head><title>%s</title><link rel="stylesheet" type="text/css" href="/static/style.css"/></head>' % name yield '<body>' yield preview yield '</body></html>'
def get_wiki_page(query): base_url = "http://en.wikipedia.org/wiki/"+urllib.quote(query) page = wikisnip.wikisnip(base_url).prettify print page