From feb70d09e89dd5d3e85984248bd3891230d4e4f0 Mon Sep 17 00:00:00 2001 From: AndreiM Date: Mon, 2 Apr 2012 17:13:36 -0400 Subject: [PATCH] Since reddit can be so random, let's make it try 3 times before saying no. --- modules/randomreddit.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/modules/randomreddit.py b/modules/randomreddit.py index cd36fec..255c742 100644 --- a/modules/randomreddit.py +++ b/modules/randomreddit.py @@ -25,8 +25,14 @@ def randomreddit(phenny, input): try: resp = web.get(url) except: - phenny.reply('Reddit or subreddit unreachable.') - return + try: + resp = web.get(url) + except: + try: + resp = web.get(url) + except: + phenny.reply('Reddit or subreddit unreachable.') + return reddit = json.loads(resp) post = choice(reddit['data']['children'])