From 0f4c290cf1c97d44f10c2daeaac219870009ffe2 Mon Sep 17 00:00:00 2001 From: lukeroge Date: Mon, 21 Nov 2011 21:44:40 +1300 Subject: [PATCH] Update plugins/shorten.py --- plugins/shorten.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/plugins/shorten.py b/plugins/shorten.py index e6f3166..55714e2 100644 --- a/plugins/shorten.py +++ b/plugins/shorten.py @@ -12,9 +12,7 @@ except ImportError, e: def tiny(url, user, apikey): try: params = urlencode({'longUrl': url, 'login': user, 'apiKey': apikey, 'format': 'json'}) - req = Request("http://api.bit.ly/v3/shorten?%s" % params) - response = urlopen(req) - j = http.get_json(response.read()) + j = http.get_json("http://api.bit.ly/v3/shorten?%s" % params) if j['status_code'] == 200: return j['data']['url'] raise Exception('%s'%j['status_txt'])