From 6897760ab7bb1f5e03b518638e7db8c8062a4d66 Mon Sep 17 00:00:00 2001 From: mutantmonkey Date: Sat, 17 Sep 2011 21:35:08 -0400 Subject: [PATCH] mylife: add my life is Harry Potter --- modules/mylife.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/modules/mylife.py b/modules/mylife.py index f2fb32d..3a841fd 100644 --- a/modules/mylife.py +++ b/modules/mylife.py @@ -106,6 +106,19 @@ def mlih(phenny, input): phenny.say(quote) mlih.commands = ['mlih'] +def mlihp(phenny, input): + """.mlihp - My life is Harry Potter.""" + try: + req = urlopen("http://www.mylifeishp.com/random") + except HTTPError: + phenny.say("This service is not available to Muggles.") + return + + doc = lxml.html.parse(req) + quote = doc.getroot().find_class('oldlink')[0][0].text_content() + phenny.say(quote) +mlihp.commands = ['mlihp'] + def mlit(phenny, input): """.mlit - My life is Twilight.""" try: