switch to requests for HTTP queries

This commit is contained in:
mutantmonkey
2013-06-08 22:27:24 -07:00
parent 259c222623
commit 5cb88f3cf8
23 changed files with 131 additions and 161 deletions

View File

@@ -4,11 +4,11 @@ short.py - vtluug url shortner
author: andreim <andreim@andreim.net>
"""
from urllib.error import HTTPError
from tools import GrumbleError
import web
import json
def short(phenny, input):
""".short <url> - Shorten a URL."""
@@ -18,11 +18,11 @@ def short(phenny, input):
return
try:
req = web.post("http://vtlu.ug/vtluug", {'lurl': url})
except (HTTPError, IOError):
r = web.post("http://vtlu.ug/vtluug", {'lurl': url})
except:
raise GrumbleError("THE INTERNET IS FUCKING BROKEN. Please try again later.")
phenny.reply(req)
phenny.reply(r)
short.rule = (['short'], r'(.*)')
if __name__ == '__main__':