ShrinkUrl: Use utils.web.getUrl instead of httplib2.

This commit is contained in:
Valentin Lorentz 2012-08-04 21:33:58 +02:00
parent ced2e7b72d
commit de5747aecb

View File

@ -30,7 +30,6 @@
import re import re
import json import json
import httplib2
import supybot.conf as conf import supybot.conf as conf
import supybot.utils as utils import supybot.utils as utils
@ -240,10 +239,9 @@ class ShrinkUrl(callbacks.PluginRegexp):
try: try:
return self.db.get('goo', url) return self.db.get('goo', url)
except KeyError: except KeyError:
text = httplib2.Http().request(self._gooApi, text = utils.web.getUrl(self._gooApi,
'POST',
headers={'content-type':'application/json'}, headers={'content-type':'application/json'},
body=json.dumps({'longUrl': url}))[1] data=json.dumps({'longUrl': url}))
googl = json.loads(text)['id'] googl = json.loads(text)['id']
if len(googl) > 0 : if len(googl) > 0 :
self.db.set('goo', url, googl) self.db.set('goo', url, googl)