fixed bug in shorten.py
This commit is contained in:
parent
37a3cc2030
commit
ac03ceb366
|
@ -15,6 +15,8 @@ class ShortenError(Exception):
|
||||||
|
|
||||||
def bitly(url, user, apikey):
|
def bitly(url, user, apikey):
|
||||||
try:
|
try:
|
||||||
|
if url[:7] != "http://":
|
||||||
|
url = "http://" + url
|
||||||
params = urlencode({'longUrl': url, 'login': user, 'apiKey': apikey, 'format': 'json'})
|
params = urlencode({'longUrl': url, 'login': user, 'apiKey': apikey, 'format': 'json'})
|
||||||
j = http.get_json("http://api.bit.ly/v3/shorten?%s" % params)
|
j = http.get_json("http://api.bit.ly/v3/shorten?%s" % params)
|
||||||
if j['status_code'] == 200:
|
if j['status_code'] == 200:
|
||||||
|
|
Reference in a new issue