Since reddit can be so random, let's make it try 3 times before saying no.
parent
7efbe19b2c
commit
feb70d09e8
|
@ -25,8 +25,14 @@ def randomreddit(phenny, input):
|
||||||
try:
|
try:
|
||||||
resp = web.get(url)
|
resp = web.get(url)
|
||||||
except:
|
except:
|
||||||
phenny.reply('Reddit or subreddit unreachable.')
|
try:
|
||||||
return
|
resp = web.get(url)
|
||||||
|
except:
|
||||||
|
try:
|
||||||
|
resp = web.get(url)
|
||||||
|
except:
|
||||||
|
phenny.reply('Reddit or subreddit unreachable.')
|
||||||
|
return
|
||||||
|
|
||||||
reddit = json.loads(resp)
|
reddit = json.loads(resp)
|
||||||
post = choice(reddit['data']['children'])
|
post = choice(reddit['data']['children'])
|
||||||
|
|
Loading…
Reference in New Issue