def shorten_url(long_url):
url_data = parse.urlencode(dict(url=long_url))
byte_data = str.encode(url_data)
ret = request.urlopen("http://tinyurl.com/api-create.php", data=byte_data).read()
result = str(ret)[2:-1]
return result
评论列表
文章目录