利用Python通过实现短链接重定向真实链接
docker run -d --name surl -p 5000:5000 lstcml/surl
/shortenPOSThttp://192.168.1.1:5000/shorten请求头
| 类型 | 值 |
|---|---|
| Content-Type | application/json |
表单
| 键值 | 类型 | 说明 |
|---|---|---|
| url | String | 必填,需转换的真实链接 |
| path | String | 可选,指定短链接路径,必须为字母和数字组成的8位字符,为空随机生成 |
示例:响应头(成功)
{
"code": 200,
"msg": "创建成功",
"path": "ic8uo6su"
}
/shortenPUThttp://192.168.1.1:5000/shorten请求头
| 类型 | 值 |
|---|---|
| Content-Type | application/json |
表单
| 键值 | 类型 | 说明 |
|---|---|---|
| url | String | 必填,需转换的真实链接 |
| path | String | 必填,若数据库查询不到,则新建短链接 |
示例:响应头(成功)
{
"code": 200,
"msg": "成功",
"ic8uo6su": "https://www.baidu.com"
}
/{path}DELETEhttp://192.168.1.1:5000/ic8uo6su示例:响应头(成功)
{
"code": 200,
"msg": "ic8uo6su短链接[https://www.baidu.com]删除成功"
}
/shorten/listGEThttp://192.168.1.1:5000/shorten示例:响应头(成功)
{
"code": 200,
"msg": "成功",
"shorten": {
"ic8uo1su": "https://www.baidu.com",
"ic8uo2su": "https://www.qq.com",
"ic8uo3su": "https://www.baidu.com",
"ic8uo4su": "https://www.qq.com",
"ic8uo5su": "https://www.baidu.com"
...
}
}
Content type
Image
Digest
sha256:c908e9f6c…
Size
45.7 MB
Last updated
about 3 years ago
docker pull lstcml/surl