Eichhoernchen/SiriServer — Issue #246: Chuck Norris jokes US
Author: moeses
Created: 2012-02-14 01:50:31+00:00
State: open

just something fun i did. if you like Chuck Norris facts, you will enjoy this. i know it isn't an issue just didn't know how or where else to put this

from plugin import *
import random
import re
import urllib2, urllib, uuid
import json
from urllib2 import urlopen
from xml.dom import minidom

class chuck(Plugin):

@register ("en-US", "Chuck Norris")
def cn_joke(self, speech, language):
req=urllib.urlopen("http://api.icndb.com/jokes/random")
full_json=req.read()
full=json.loads(full_json)
self.say(full['value']['joke'])
self.complete_request()