mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
ShrinkUrl: Use utils.web.getUrl instead of httplib2.
This commit is contained in:
parent
ced2e7b72d
commit
de5747aecb
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user