首页 > 代码库 > 短链接生成原理

短链接生成原理

import requestsimport jsonimport hashliburl = http://a.qbao.com/shortparam={"longUrl":r"http://m.qianbao666.com/api/v30/share4Client/share?type=3&prizeMoney=1,5765"}r = requests.post(url,data=http://www.mamicode.com/param)print r.text{"ok":true,"longUrl":"http://m.qianbao666.com/api/v30/share4Client/share?type=3\u0026prizeMoney=1,5765","shortUrl":"http://a.qbao.com/Pg"}http get http://a.qbao.com/Pg<a href=http://www.mamicode.com/"http://m.qianbao666.com/api/v30/share4Client/share?type=3\u0026prizeMoney=1,5765">Moved Permanently</a>.

 

短链接生成原理