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
1 changed files with 2 additions and 4 deletions

View File

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