Update plugins/shorten.py
This commit is contained in:
parent
7dfb881e42
commit
0f4c290cf1
1 changed files with 1 additions and 3 deletions
|
@ -12,9 +12,7 @@ except ImportError, e:
|
||||||
def tiny(url, user, apikey):
|
def tiny(url, user, apikey):
|
||||||
try:
|
try:
|
||||||
params = urlencode({'longUrl': url, 'login': user, 'apiKey': apikey, 'format': 'json'})
|
params = urlencode({'longUrl': url, 'login': user, 'apiKey': apikey, 'format': 'json'})
|
||||||
req = Request("http://api.bit.ly/v3/shorten?%s" % params)
|
j = http.get_json("http://api.bit.ly/v3/shorten?%s" % params)
|
||||||
response = urlopen(req)
|
|
||||||
j = http.get_json(response.read())
|
|
||||||
if j['status_code'] == 200:
|
if j['status_code'] == 200:
|
||||||
return j['data']['url']
|
return j['data']['url']
|
||||||
raise Exception('%s'%j['status_txt'])
|
raise Exception('%s'%j['status_txt'])
|
||||||
|
|
Reference in a new issue