官方的文件库

从你的Python的网站或应用程序生成安全的短链接。目前的版本是1.1..

Python 2.4及以上压缩,扩长和跟踪网址libsafemn.py-1.1.zip

代码

import libsafemn
short_url = libsafemn.shorten('http://www.google.com/')
print "Short: " + short_url
expand_url = libsafemn.expand(short_url)
print "Long: " + expand_url
info = libsafemn.info(short_url)
print "Clicks: " + info.get('clicks', None)

输出

Short: http://safe.mn/d
Long: http://www.reviews-web-hosting.com/
Clicks: 185