summaryrefslogtreecommitdiffstats
path: root/modules/oblique.py
diff options
context:
space:
mode:
Diffstat (limited to 'modules/oblique.py')
-rwxr-xr-xmodules/oblique.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/oblique.py b/modules/oblique.py
index e53ec29..3622b4a 100755
--- a/modules/oblique.py
+++ b/modules/oblique.py
@@ -34,10 +34,15 @@ def service(phenny, input, command, args):
template = template.replace('${nick}', urllib.quote(input.nick))
uri = template.replace('${sender}', urllib.quote(input.sender))
+ info = web.head(uri)
+ if isinstance(info, list):
+ info = info[0]
+ if not 'text/plain' in info.get('content-type', '').lower():
+ return phenny.reply("Sorry, the service didn't respond in plain text.")
bytes = web.get(uri)
lines = bytes.splitlines()
if not lines:
- return phenny.reply('Sorry, the service is broken.')
+ return phenny.reply("Sorry, the service didn't respond any output.")
phenny.say(lines[0][:350])
def refresh(phenny):